WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 06-15-2009, 07:00 AM
Saz Saz is offline
Member
 
Join Date: Nov 2008
Posts: 36
Timed changing message on screen

Hi,

I'm trying to get a 'stop' message appear on the screen 10 seconds into the program, which waits for a second and then changes to 'go'. I've had various attempts and whilst I can get the intial message up (whether it starts off as go or appears at 10s in as stop), it won't change over to the other message.

This is one example of code used:

Code:
#Stop and go message
text_go=vizinfo.add('GO')
text_go.translate(.5, .9)
text_go.fontSize (35)

def stopSign():

	text_go.message('STOP')
	viz.waittime (1)
	text_go.message ('GO')
vizact.ontimer (10,stopSign)
and this is another:

Code:
def stopGo():
    Wait 10 secs
    viz.waittime(10)
    text.message( 'STOP' )
    #Wait 1 sec
    viz.waittime(1)
    text.message( 'GO' )
viz.director( stopGo )
which also fails to work, any ideas on what I'm doing wrong?
Reply With Quote
  #2  
Old 06-15-2009, 02:28 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
you could use the following
Code:
#Stop and go message
text_go=vizinfo.add('GO')
text_go.translate(.5, .9)

def stopSign():

	text_go.message('STOP')
	vizact.ontimer2(1,0, text_go.message,'GO')

vizact.ontimer(10,stopSign)
your first example uses viz.waittime but its not in a director function
Reply With Quote
  #3  
Old 06-16-2009, 05:56 AM
Saz Saz is offline
Member
 
Join Date: Nov 2008
Posts: 36
Cheers Jeff - you're a star! I have got another problem though - all of a sudden the output data will not write to the specified file - it was fine and then suddenly stopped working. The code I have is as follows:
Code:
directory = 'Y:\backup\Vizard30\resources\road'
subjectd = 'speed_.txt' + str(subject)
filename = directory+subjectd
file = open(filename, 'w')

def mytimer (num):
	
	out = (str(round(speedm,1)) + '\n')
	file.write(out)
	file.flush()
	print out
viz.callback( viz.TIMER_EVENT, mytimer )
viz.starttimer( 0, 0.25, viz.FOREVER )
but now this message appears:
Traceback (most recent call last):
File "<string>", line 11, in ?
File "roadldstop.py", line 167, in ?
file = open(filename, 'w')
IOError: [Errno 2] No such file or directory: 'Y:\x08ackup\\Vizard30\resources\roadspeed_.txt222 2'

I know the path exists so is this message because it's trying to create a temporary file when outputting the data?
Reply With Quote
  #4  
Old 06-17-2009, 04:14 AM
Saz Saz is offline
Member
 
Join Date: Nov 2008
Posts: 36
No worries Jeff - sorted it out and now working
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
split screen honey006 Vizard 3 05-21-2009 10:57 AM
Remove the credits on the run screen Saz Vizard 1 11-21-2008 10:01 AM
screen image erchrastil Vizard 8 06-27-2008 12:45 PM
position of html-file on screen active_world Vizard 1 05-16-2008 08:24 PM
accessing screen buffer hotspur1 Vizard 3 08-22-2003 04:31 PM


All times are GMT -7. The time now is 02:29 PM.


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