[Tutor] working with Tkinter

alan.gauld@bt.com alan.gauld@bt.com
Thu, 25 Apr 2002 18:06:49 +0100


> class prg:
>    button1= Button(text="whatever", command= self.do_whatever)
>    # more buttons and widgets
> 
>    def whatever(self):
>    #   and here other dialog with its buttons calling more dialogs.

Do you mean inline or do you create the other dialog definitions in other
classes?

class Dialog1(TopLevel):
    button1 = Button(.... command=self.doButton1)

    def doButton1(self):
    # do stuff here

class Dialog2(TopLevel):
    button1 = Button(.... command=self.doButton1)

    def doButton1(self):
    # do stuff here

You can use parameters to the constructor to explicitly pass 
a reference to the calling class or navigate the parent 
heirarchy maintained by Tkinter.

Alan g.