I have what I think is a pretty simple problem, but for the life of me I
can't figure it out. I would like to create my own events. I'm writing an
instant messenger client and I would like to have one thread maintain the
connection to the server and when it receives a message or other event, send
an event through the wxEvent system that I can catch from my GUI layer. I'm
having problems with merely subclassing wxEvent, in particular it doesn't
like me calling the superclass's constructor wxEvent.__init__(self)
Any idea how to go about creating custom events?
I have what I think is a pretty simple problem, but for the life of me I
can't figure it out. I would like to create my own events. I'm writing an
instant messenger client and I would like to have one thread maintain the
connection to the server and when it receives a message or other event,
send
an event through the wxEvent system that I can catch from my GUI layer.
I'm
having problems with merely subclassing wxEvent, in particular it doesn't
like me calling the superclass's constructor wxEvent.__init__(self)
Any idea how to go about creating custom events?
See the demo. (Hint, you want to derive from wxPyEvent.)
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!
class CEvent_Foo(wx.wxPyEvent):
def __init__(self, anything):
wx.wxPyEvent.__init__(self)
self.anything = anything
evt = CEvent_Foo(333, 123 )
wxPostEvent(tree, evt)
del evt
···
----- Original Message -----
From: "Casey Crabb" <debug@discobob.dyndns.org>
To: <wxpython-users@lists.wxwindows.org>
Sent: Monday, September 10, 2001 4:31 PM
Subject: [wxPython] Custom events
I have what I think is a pretty simple problem, but for the life of me I
can't figure it out. I would like to create my own events. I'm writing an
instant messenger client and I would like to have one thread maintain the
connection to the server and when it receives a message or other event,
send
an event through the wxEvent system that I can catch from my GUI layer.
I'm
having problems with merely subclassing wxEvent, in particular it doesn't
like me calling the superclass's constructor wxEvent.__init__(self)
Any idea how to go about creating custom events?