Can you change a Tkinter widget's master?

Fredrik Lundh fredrik at pythonware.com
Mon May 14 12:53:42 EDT 2001


sternber at socrates.Berkeley.EDU wrote:
>
> >you can use template classes, which can be composed freely,
> >and which creates the real widgets on demand.  an example:
> >
> >    dialog = Dialog(
> >        Label(text="enter your name"),
> >        Entry(width=20, name="name"),
> >        ButtonBox(
> >            Button(text="OK", command=self.ok),
> >            Button(text="Cancel", command=self.cancel)
> >            )
> >        )
> >    result = dialog.display()
> >    if result:
> >        print result.name
> >
> >(this is from an unpublished corner of Tkinter 3000)
>
> The problem is that the Label, Entry and ButtonBox won't have dialog
> as their master.

I didn't say Label was a Tkinter.Label, did I?

(hint: that code works perfectly fine, if you add the right
from-import line...)

Cheers /F





More information about the Python-list mailing list