scrutinizer@gmx.at wrote:
(main thread)
progressdlg, which i want to update
EVT_BUTTON(self, 9999, self.OnUpdateProgress)
def OnUpdateProgress ...
print "updating"
Here you've connected a button event from a Button with an id of 9999 to your OnUpdateProgress() method
(worker thread is created with import thread; as in wxpython thread example)
def NotifyProgress(self):
event = wxCommandEvent ()
event.m_eventType = wxEVT_COMMAND_LISTBOX_SELECTED
event.m_id = 9999
wxPostEvent(self.m_pWndProgress, event)
print "sending"
Here you are creating a custom CommandEvent, of the type:
wxEVT_COMMAND_LISTBOX_SELECTED
and posting it to the window: self.m_pWndProgress
self.m_pWndProgress is valid, "sending" is shown, but never "updating"
you're not going to catch a wxEVT_COMMAND_LISTBOX_SELECTED event with an EVT_BUTTON call
The easiest way to do this is to use wxCAllAfter(), but if that won't work for you, you should probably create your own custom event, and then bind it with your own custom event binding function, as per:
http://wiki.wxpython.org/index.cgi/CustomEventClasses
It's also possible to to what you seem to be trying to do, and create an event of an existing type, but it should be a button event, in this case, and I probably wouldn't do that. Clicking on a button is a different thing that whatever your thread is doing, even if you want them to call the same method.
Make sure you read:
http://wiki.wxpython.org/index.cgi/LongRunningTasks
As well.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov