wxPython update problem

Nils Grimsmo nilsgri at idi.ntnu.no
Mon Apr 7 07:36:03 EDT 2003


On Mon, 07 Apr 2003 07:06:08 -0400, Peter Hansen wrote:
> Nils Grimsmo wrote:
>> 
>> class MainWindow(wxFrame):
>>     label = ["foo", "bar"]
>>     button = None
>>     def __init__(self, parent, id, title):
>>         wxFrame.__init__(self, parent, -4, title, size = (100, 100))
>>         self.button = wxButton(self, 13, self.label[0])
>>         EVT_BUTTON(self, 13, self.run)
>>         self.Show(true)
>> 
>>     def run(self, event):
>>         for c in range(2):
>>             for x in [0, 1]:
>>                 self.button.SetLabel(self.label[x])
>>                 # please update. pretty, please!
>>                 time.sleep(1.0)
> 
> When do you think/hope run() will be called?  I don't think that
> method is looked for by wxPython...  Did you base this on 
> some sample code?

run() is called when you push the button. run() sets the label for the
button every second for four seconds, but the button label is not updated
before you return from run().

that is not the behavior i want. any suggestions?


klem fra nils
 
-- 
nils grimsmo
nilsgri at idi.ntnu.no





More information about the Python-list mailing list