[Tkinter-discuss] using pybwidget
Jeff Epler
jepler at unpythonic.net
Sun Nov 28 20:57:10 CET 2004
Some examples would doubtless be useful.
All of the classes defined in bwidget are widgets. You can use them
exactly the same as you use widgets in Tkinter, with the biggest
difference being that "default root" is not supported (you must always
specify a master for a bwidget).
contrary to what a first glance may make you expect, test.py *does*
create a bwidget: Button is bwidget.Button, not Tkinter.Button. Its
primary added feature is the "link" relief, which allows buttons to be
flat but raise on mouseover, like toolbar icons on Windows.
Below is a demo which shows two more widgets: NoteBook and
ScrolledWindow. I discovered a couple of stupid bugs in NoteBook and
fixed it in pybwidget-0.1.1, also on tkinter.unpythonic.net/bwidget .
Jeff
#------------------------------------------------------------------------
import bwidget, Tkinter, sys, os
app = Tkinter.Tk(); app.wm_title("pybwidget demo")
notebook = bwidget.NoteBook(app, arcradius=2); notebook.pack()
files = sys.argv[0], Tkinter.__file__, bwidget.__file__
for i, f in enumerate(files):
if f.endswith(".pyc"): f = f[:-1]
page = notebook.insert(Tkinter.END, i, text=os.path.basename(f))
sw = bwidget.ScrolledWindow(page)
text = Tkinter.Text(sw)
text.insert(Tkinter.END, open(f).read())
sw.setwidget(text)
sw.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=True)
notebook.compute_size()
app.mainloop()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tkinter-discuss/attachments/20041128/42dbe4a1/attachment.pgp
More information about the Tkinter-discuss
mailing list