wxPython update problem

Nils Grimsmo nilsgri at idi.ntnu.no
Mon Apr 7 12:05:56 CEST 2003


i have a problem getting wxPython to update the gui while the thread is
running user procedures. i have tried calling wxWindow.Refresh() and
wxWindow.Update() in various orders both on the wxFrame and the wxButton, 
but the gui doesn't update.

i have posted source for a test program below. what i would like it to do,
is to update the button with the new label before control is returned from

from wxPython.wx import *
import time

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)

    def run(self, event):
        for c in range(2):
            for x in [0, 1]:
          	# please update. pretty, please!

app = wxPyApp()
frame = MainWindow(None, -1, "Hello World")

another thing i am wondering about is to disable the button
temporarily. must i use wxEvtHandler::Disconnect?

nils grimsmo
nilsgri at idi.ntnu.no

More information about the Python-list mailing list