[Tutor] commands with multiple things to do?

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Tue Mar 29 08:16:42 CEST 2005


Quoting Diana Hawksworth <dianahawks at optusnet.com.au>:

> Is it possible for me to make a command do multiple things instead of
> 1?

Not directly ... But you can always write a function that does both things.

>  self.submit_bttn = Button(self, text = "Tries: 0", command =
> self.reveal, self.update_count)

eg:

    def callback():
        self.reveal()
        self.update_count()
    self.submit_bttn = Button(self, text='Tries: 0', command=callback)

In python, function definitions can be placed anywhere (including inside other
functions).

HTH.

-- 
John.


More information about the Tutor mailing list