WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-08-2010, 04:03 AM
Josh Josh is offline
Member
 
Join Date: Jan 2010
Posts: 63
Thank you. But I don't know how exactly I can use this now... I'm sorry, I'm absolutely new to Python and to the theories that stand behind events in WorldViz...
Reply With Quote
  #2  
Old 03-08-2010, 04:24 AM
IGoudt IGoudt is offline
Member
 
Join Date: Sep 2009
Posts: 20
Whenever you register a function with vizact.onkeydown a reference is made in memory between the keystroke and the function. What you wish to achieve is to break that reference. A way to do that, have your program memorize that reference as a variable and then do some operation on that variable, in this case: removeEvent.

Take for example:
Code:
def initialiseProgram():
     playJokeEvent = vizact.onkeydown(' ', play_first_joke)
     ... other initialisation

def play_first_joke():
     vizact.removeEvent(playJokeEvent)
     .. do your fancy scene stuff here
I have to admit that I am used to program OOP in classes, and the handling of variables is different when using classes in python than when using direct code (self, vs, global). Try this code snippet first, if it doesn't work out well then we might to do some hacking with the [global] statement.

Last edited by IGoudt; 03-08-2010 at 04:29 AM.
Reply With Quote
  #3  
Old 03-08-2010, 12:49 PM
Josh Josh is offline
Member
 
Join Date: Jan 2010
Posts: 63
Thanks, that helps a lot. :-)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
onkeydown list of values Cheff Vizard 2 07-02-2008 02:00 AM


All times are GMT -7. The time now is 06:16 AM.


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