Adding tkinter modules to notebook tabs

Terry Reedy tjreedy at udel.edu
Sat Apr 4 23:21:36 EDT 2020


On 4/4/2020 10:59 AM, Rich Shepard wrote:
> My Python3-3.8.2 application has 8 modules with subject-specific data
> entry/editing widgets and I want to display each module on a ttk.Notebook.
> Each notebook resource I've found in my reference books and on the web
> describe how to create a notebook and tabs and add labels to the tabs; a 
> few
> describe how to place individual widgets on a tab. But I've not found 
> how to
> place a widget-filled module on a notebook tab.

IDLE's currently-working Settings dialog uses a  ttl.Notebook with 5 
tabs.  To see it, run IDLE and on the top menu, select Options => 
Configure IDLE.  Each tab displays a ttk.Frame with multiple widgets. 
Where there is a choice, ttk widgets are used.  They make the most 
different on macOS and least difference on Windows (because the tk 
widgets look pretty good there).

The code is in idlelib/configdialog.py.  ConfigDialog creates a window 
and notebook and adds the tab frames.  As Christian indicated, the 
notebook itself takes very little code.  Each of the tab frames is a 
separate Frame subclass in the same file, but they could be in separate 
files.

-- 
Terry Jan Reedy



More information about the Python-list mailing list