Having played around a little with both Tkinter and wxPython, I like Tkinter much better in terms of how clean my source code looks. However, it doesn't seem to have as many features; in particular it doesn't have tabs (as in, the tabs at the top of a Firefox window).
A little Googling on the subject offers a few suggestions. There's a cookbook entry with a class allowing you to use tabs, but it's very primitive. There's also Python megawidgets on SourceForge, although this seems very old and gave me errors during installation.
Does anyone have experience making tabbed GUIs in Tkinter? What did you use? Or is it simply the case that anyone who needs more powerful windowing components has to use wxPython?
Best Solution
On recent Python (> 2.7) versions, you can use the
ttk
module, which provides access to the Tk themed widget set, which has been introduced inTk 8.5
.Here's how you import
ttk
in Python 2:In Python 3, the
ttk
module comes with the standard distributions as a submodule oftkinter
.Here's a simple working example based on an example from the
TkDocs
website:Another alternative is to use the
NoteBook
widget from thetkinter.tix
library. To usetkinter.tix
, you must have theTix
widgets installed, usually alongside your installation of theTk
widgets. To test your installation, try the following:For more info, check out this webpage on the PSF website.
Note that
tix
is pretty old and not well-supported, so your best choice might be to go forttk.Notebook
.