Newbie elementary question

Gordon McMillan gmcm at
Mon Aug 30 15:37:47 CEST 1999

rainer2207 at writes:

> Can someone please explain what "self" and
> "master" are?
> eg.
> At the moment I have
> class Interface:
>       def __init__(self, master):
>             ....
>             ....
> root = Tk()
> inter = Interface(root)
> root.mainloop()
> I'm assuming that master is the root window and
> self is the instance name of the window in the
> class. 


> But I've also seen master=None. Can
> someone please explain this?

If you're asking about Python syntax, it's the way you specify a 
default value. If you're asking about Tk, I think dialogs run their 
own message loop, so don't require hooking into the root window's 
message loop.

- Gordon

More information about the Python-list mailing list