[Tutor] Tkinter - master attribute

Steven D'Aprano steve at pearwood.info
Tue Jun 8 18:52:08 CEST 2010


On Wed, 9 Jun 2010 02:38:28 am Jim Byrnes wrote:
> When reading code examples I see things like
> theframe.master.title('spam) or
> def __init__(self, master):
>      frame = Frame(master)
>
> When I encounter these I tend to get bogged down trying to decide if
> "master" has special meaning or is just a name the author has chosen.
> For example is it similar to Buttton(text='spam) where text in this
> case has special meaning.

To understand Tkinter effectively, you have to know it is an interface 
to the Tk language (hence the name TK INTERface).

Googling on "tk master widget" brings me to this:

http://www.tkdocs.com/tutorial/concepts.html

which includes this:

Geometry management in Tk relies on the concept of master and slave 
widgets. A master is a widget, typically a toplevel window or a frame, 
which will contain other widgets, which are called slaves. You can 
think of a geometry manager as taking control of the master widget, and 
deciding what will be displayed within.

I suppose you could say that master and slave widgets could be named 
parent and child widgets instead.



-- 
Steven D'Aprano


More information about the Tutor mailing list