WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-12-2009, 11:48 AM
Penguin Penguin is offline
Member
 
Join Date: Mar 2009
Posts: 14
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)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Howto debug a custom plugin? reedev Plug-in development 3 04-23-2009 02:16 PM
Adding custom faces mjabon Vizard 2 04-01-2009 08:34 PM
How do I add custom functions to a custom plugin? reedev Plug-in development 7 02-01-2009 03:39 AM
animating custom faces: in search of "open_mouth" morphs vr_boyko Vizard 1 09-16-2004 10:30 AM
Creating Custom Avatar Heads farshizzo Vizard 22 09-12-2004 09:23 PM


All times are GMT -7. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC