PDA

View Full Version : Beginner's troubleshoot


alemenchaca
11-21-2005, 01:55 PM
I'm learning to use Vizard with the tutorial. I started with the Keyboard Interaction section, copypasted the code from the tutorial (see below) and my screen doesn't do what it is supposed to do. Could anyone help me? I'm so new in this that I don't really know what is wrong.
Thanks!
Alejandra.

MY CODE:
import viz

viz.go()

micuarto = viz.add('room.wrl') # Add room to your empty world
pantalla = micuarto.getchild('screen') # Get access to a subobject screen in the room

# Add the projected light to the room and translate it to it's correct location
luz = viz.add('light.WRL')
luz.translate(0,2.25,0)

def mytimer(num):

pass

def mykeyboard(key):

# If the user presses the u key do something
if key == 'u':
# Move the screen up
pantalla.goto(0,3,0,.5)
print 'up'

# If the user presses the d key, do something
if key == 'd':
# Move the screen down
pantalla.goto(0,0,0,.5)
print 'down'

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.5,-1)

viz.callback(viz.KEYBOARD_EVENT,mykeyboard)