WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #1  
Old 10-18-2007, 10:46 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Just register the timer in your keyboard callback:
Code:
def timer1():
    print 'Elapsed time:',viz.elapsed(), 'seconds'

def onkeydown(key):
    if key == ' ':
        quad.add(MovingRoom)
        vizact.ontimer(60,timer1)
Also, in the future please use the [code][/code] tags when posting code snippets. It preserves the indentation, which is necessary for python scripts.
Reply With Quote
  #2  
Old 10-18-2007, 11:20 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
I tried exactly that. That was my first thought, but I got this error message:

Traceback (most recent call last):
File "<string>", line 2, in ?
File "MOVING ROOM (FINAL).py", line 61
vizact.ontimer(60,timer1)
^
SyntaxError: invalid syntax


So that's why I'm stuck
Reply With Quote
  #3  
Old 10-18-2007, 11:29 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
That means the indentation on that block of code is inconsistent. Select the entire block of code in Vizard then press Alt-T to tabify the region. Vizard 3.0 will display squiggly lines on lines of code with inconsistent indentation. I would suggest upgrading if possible.
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 10:50 PM.


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