473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1201

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark Smithers | last post by:
Hi All, I'm having a frustrating time trying to debug an ASP (not ASP.NET) app on my W2003 dev server running II6. I continually get a HTTP 500 error message despite configuring IIS 6 to...
5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
11
by: Chris | last post by:
I have searched this group for answers and tried the responses. I am trying to Use an full online backup from our production server and apply it to our test server. The Tablespaces in the...
7
by: hierro | last post by:
I have a list of functions (all with suffix T). For each one, I need to implement the following: FunctionT() { if (some_condition) { // do some conversion first FunctionW(); // then do some...
3
by: Kent | last post by:
The following is a greatly simplified example of what I would like to accomplish using the event/delegate features of .NET I have a class "NumGen" that produces a random set of numbers between 0...
0
by: Karsten | last post by:
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...
8
by: Ian Mackenzie | last post by:
Hi Guys I am VERY new to DB2 and have created a workingdays function to return the working days between 2 dates, but I get some compiler errors when running it: CREATE FUNCTION WORKINGDAYS...
3
by: Rinaldo | last post by:
Hi, I have a label on my dialogbox who has to change text while running. This is what I do: lblBackup.Text = "Bezig met de backup naar " + F1.FTPserver; but the text does'nt appear, only if...
4
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.