#1
|
|||
|
|||
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) Code:
def stopGo(): Wait 10 secs viz.waittime(10) text.message( 'STOP' ) #Wait 1 sec viz.waittime(1) text.message( 'GO' ) viz.director( stopGo ) |
#2
|
|||
|
|||
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) |
#3
|
|||
|
|||
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 ) 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? |
#4
|
|||
|
|||
No worries Jeff - sorted it out and now working
|
|
|
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 |