|
#1
|
|||
|
|||
Depending on how you are handling the different key callbacks, you can unregister the specified key callback when you want it to be deactivated. Then simply register the callback again when you want the key activated. How are you handling the key presses, are you using the vizact.onkeydown functions or the viz.callback functions?
|
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
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) |
|
|