WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-01-2008, 10:36 AM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Hello,

I am using both. At one point of time, I am using viz.callback and another time, I am using onKeyDown function.

Registering key callback....what you suggested is not clear to me. Can you please elaborate a little bit more?

Thanks

Uttama
Reply With Quote
  #2  
Old 08-01-2008, 11:10 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is some sample code showing how to switch between 2 different keydown callback functions. You can press the 1,2 keys to set which callback to use. Pressing spacebar will print out which callback is currently registered.
Code:
import viz
viz.go()

def onKeyDown1(key):
	
	if key == '2':
		viz.callback(viz.KEYDOWN_EVENT,onKeyDown2)
	
	elif key == ' ':
		print 'space pressed in callback 1'
		
def onKeyDown2(key):
	
	if key == '1':
		viz.callback(viz.KEYDOWN_EVENT,onKeyDown1)
	
	elif key == ' ':
		print 'space pressed in callback 2'

viz.callback(viz.KEYDOWN_EVENT,onKeyDown1)
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


All times are GMT -7. The time now is 08:38 PM.


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