Hello, I've got a question about Python Events. I want to generate a PyCommandEvent (included in the wx Package). This PyCommandEvent ought to be called when a method/function is called. I've seen some examples in the www how I can call the Event when an other Event is called. But this is not useful for me, because I want to generate a Event at runtime. Example: I've written a program which use the win32com interface of SAPI 5. When a word is recognated, this word will be transported to the "major" module by calling a method of a class within this method. When this method is called I want, that the method generate/process a PyCommandEvent.
this code I have now: ############################################################################## myEVT_SR_RECOGNITION = wx.NewEventType() EVT_SR_RECOGNITION = wx.PyEventBinder(myEVT_SR_RECOGNITION, 1) class COM_SR_REC: def __init__(self): print "init COM_SR_REC" def OnRecognition(self,text): print "I heared: " + text make_event = MakeSREvent(text) def MakeSREvent(self, text): start_event = SR_Event(myEVT_SR_RECOGNITION,1) start_event.WordRec(text) self.GetEventHandler().ProcessEvent(start_event) start_event.Skip() class SR_Event(wx.PyCommandEvent): def __init__(self, eventType, id): wx.PyCommandEvent.__init__(self, eventType, id) ################################################################## I think the class SR_EVENT works accurate. The problem is, that I can't call the Event by using 'GetEventHandler' because there is no EventHandler in class COM_SR_REC. How can I call/process the Event??????? Is the rest of the code right??????? Next Question: How can I listen to those PyCommandEvents from other modules? Thanks for help! -- http://mail.python.org/mailman/listinfo/python-list