![]() |
|
#1
|
|||
|
|||
|
custom events within classes
Hi, is it possible to register more than one function for listing on a custom event? When pressing the 'e'-button the following code should print out 'B' and 'C'. But only 'C' is printed out. When I swap the two *.enableEvent(EVENT) lines then 'B' is printed out.
Therefore I guess only one function can listen to an event at the same time. Am I right? Code:
import viz
class A(object):
def __init__(self):
pass
def enableEvent(self, EventID):
viz.callback(EventID,self.doit)
def doit(self):
pass
class B(A):
def __init__(self):
pass
def doit(self):
print "B"
class C(A):
def __init__(self):
pass
def doit(self):
print "C"
viz.go()
EVENT = viz.getEventID('EVENT')
b = B()
b.enableEvent(EVENT)
c = C()
c.enableEvent(EVENT)
def sendEvent():
viz.sendEvent(EVENT)
vizact.onkeydown('e',sendEvent)
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Howto debug a custom plugin? | reedev | Plug-in development | 3 | 04-23-2009 03:16 PM |
| Adding custom faces | mjabon | Vizard | 2 | 04-01-2009 09:34 PM |
| How do I add custom functions to a custom plugin? | reedev | Plug-in development | 7 | 02-01-2009 04:39 AM |
| animating custom faces: in search of "open_mouth" morphs | vr_boyko | Vizard | 1 | 09-16-2004 11:30 AM |
| Creating Custom Avatar Heads | farshizzo | Vizard | 22 | 09-12-2004 10:23 PM |