Creating custom event in WxPython

NutJob at gmx.net NutJob at gmx.net
Thu Sep 1 08:51:47 EDT 2005


Hello,

I'm faced with the following problem: I have a (secondary) thread that
monitors a socket for incoming message traffic using the
select.select() function.

Besides that I also have the main thread of my WxPython application. So
far so good.

Now when my socket thread detects an incoming message, I need my main
thread to interpret the message and react to it by updating the GUI.
IMO the best way to achieve this is by having my socket thread send a
custom event to my application's event loop for the main thread to
process. However, I'm at a total loss as far as creating custom events
is concerned. The WxWindows documentation isn't very helpful on this
either.
I think I need to derive my own event class from the wxEvent class, but
I have no idea HOW (i.e. what methods do I need to override, etc.) Can
anyone help me?




More information about the Python-list mailing list