WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-19-2006, 01:33 PM
Wenamun Wenamun is offline
Member
 
Join Date: Jan 2006
Location: Milwaukee Wisconsin
Posts: 11
Timer vs. Keyboard input

Hi.
I want to trigger a series of actions with a single keystroke.
Some of these actions need to use viz.FASTEST_EXPIRATION and viz.FOREVER though, as I am getting input from a mouse and a PPT system.

Here's my code:

viz.go()

PORT_PPT = 4

ball = viz.add('white_ball.wrl')
ball.translate(0,1,8)
ball.alpha(0)

#Now we press "1"
#The ball fades in...
#The ball scales vertically according ...
#to the height of the mouse...
#but it only scales to the initial height...
#it doesn't update in real time.

def ontimer(num):
if viz.iskeydown('1'):
print '"1" key is down'
mousePos = viz.mousepos()
ball.scale(3,mousePos[1])
ball.fade(0,1,4)
elif viz.iskeydown('u'):
print "Undo"
ball.fade(1,0,2)
viz.callback(viz.TIMER_EVENT, ontimer)
viz.starttimer(1,viz.FASTEST_EXPIRATION, viz.FOREVER)


thanks for any help!

-Wenamun
Reply With Quote
 

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 05:52 PM.


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