![]() |
|
#3
|
|||
|
|||
|
From my experience, you can register events only once.
For example: Class A registers a viz.MOUSEDOWN_EVENT Class B registers a viz.MOUSEDOWN_EVENT Then if I recall correctly the last register will overwrite the first. What I did to resolve this, is to put all the registers in one of the main, or container, classes. Whenever an event is triggered there, the main class redirects the event to the appropiate classes or objects. In your case, I guess your main class creates an instance of the MusicOnOff class (a button), and saves it under a variable. Change to: Code:
class MusicOnOff:
def __init__(self,musicObj):
self.Obj = musicObj
self.musicIcon = viz.addTexQuad()
self.pictures = [viz.add(‘musicOff.png'), viz.add('musicOn.png')]
self.musicIcon.texture(self.pictures[1])
self.musicOn = True
def click(self):
self.musicOn = not self.musicOn
self.musicIcon.texture(self.pictures[self.musicOn])
if not self.musicOn:
self.Obj.pause()
else:
self.Obj.play()
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Realistic Light and Shadows Using Vizard and 3DS Max | jde | Vizard | 4 | 07-13-2012 11:58 AM |
| .3DS importing in Vizard and 3D Studio | jde | Vizard | 1 | 08-28-2009 04:14 PM |
| Vizard tech tip: Using the Python Imaging Library (PIL) | Jeff | Vizard | 0 | 03-23-2009 12:13 PM |
| Vizard tech tip: Text to Speech | Jeff | Vizard | 1 | 01-15-2009 10:39 PM |
| Vizard and Augmented Reality | realvision | Vizard | 4 | 04-04-2008 11:59 AM |