|
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|