"Jim Byrnes" <[email protected]> wrote in
When reading code examples I see things like
theframe.master.title('spam)
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.
In the first case master is an attribute of the frame and as
such is defined by the frame definition.
In the second case master is just an arbitrary name for a
parameter like any other. Because it is being used to correspond
to the master attribute of the Framer(as seen in the call to Frame() )
the author has used the name master too. But other common
names for the same attribute are parent, root, top, etc
For example is it similar to Buttton(text='spam) where text in this
case has special meaning.
In the first example yes, in the second no.
Although 'text' is even more special because it is actually defined in
the underlying Tk code rather than in Tkinter Python code.
I've goolged and found references to "widgets master attributes" but
nothing to really explain it. Could someone point me to a good
reference so that I could better understand it use.
Because Tkinter is a thin wrapper around the underlying Tk tookit
many atttributes of widgets are actually defined in the Tk code
and simply mirrored by Tkinter. In that sense the widget attributes
tend to have fixed names. But in Tkinter code the naming is
essentially arbitrary and follows the usual Python naming
conventions.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor