| NoteBook |
UserPreferences |
| Tkinter Wiki | FrontPage | RecentChanges | TitleIndex | WordIndex | SiteNavigation | HelpContents | moin.sf.net |
The NoteBook widget is useful for displaying information from more than one file at a time. The example below makes use of both Tkinter and Bwidget widgets.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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() |
Screenshot: