469,915 Members | 2,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,915 developers. It's quick & easy.

Problem with processing PyCommandEvent

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!
Nov 22 '05 #1
0 1135

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark Smithers | last post: by
11 posts views Thread by Chris | last post: by
7 posts views Thread by hierro | last post: by
3 posts views Thread by Kent | last post: by
reply views Thread by Karsten | last post: by
8 posts views Thread by Ian Mackenzie | last post: by
3 posts views Thread by Rinaldo | last post: by
4 posts views Thread by Jimmy | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.