wxPython update problem
Nils Grimsmo
nilsgri at idi.ntnu.no
Mon Apr 7 06:05:56 EDT 2003
hi!
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
run().
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)
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)
app = wxPyApp()
frame = MainWindow(None, -1, "Hello World")
app.MainLoop()
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