#1
|
|||
|
|||
Timer for experiment
Hi Jeff,
I'm using Vizard to run an experiment. I used viz.tick() to register a startTime for an action e.g. turn ON the power of a system. I added a delay for the simulation to complete the process. Recently, I added viz.pause and viz.play to my program so that I could pause the simulation at any time to ask questions. However, I realized that viz.tick() is still running even when I pause the simulation. As my progress bar update is based on viz.tick() it did not pause as I expected. Is there ways to stop viz.tick() when I pause the program or would you recommends I use other methods to register my time. Thank you. def displayProcessTime(): global RemainingTime global StartTime global EstimatedTime global Time print 'displayProcessTime function' if 'SHUTDOWN' not in instrList[currentStep[0]][0]: StartTime = viz.tick() EstimatedTime = StartTime + int(timing[instrument][1]) #RemainingTime = EstimatedTime - viz.tick() else: StartTime = viz.tick() EstimatedTime = StartTime + int(timing[instrument][2]) #RemainingTime = EstimatedTime - viz.tick() ..... while viz.tick() <= EstimatedTime: print 'SSRMS PB' yield viztask.waitTime(0.5) UpdateProgressBar() myBar.set(ProgressBarLevel) |
#2
|
|||
|
|||
Try using the viz.getFrameTime command. The frame time will not increase when viz.pause is called:
Code:
''' Press 1 to play Press 2 to pause ''' import viz import vizact import vizinfo viz.go() vizinfo.InfoPanel() viz.pause() def printTime(): print viz.getFrameTime() vizact.ontimer(0,printTime) vizact.onkeydown('1',viz.play) vizact.onkeydown('2',viz.pause) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Timer events within a Tkinter class | kevin | Vizard | 2 | 07-29-2011 12:10 PM |
Question about Vizard Expiration Timer Rate | mizutani_jun | Vizard | 2 | 02-23-2011 09:13 PM |
Timer event in viztask | GiudiceLab | Vizard | 1 | 10-07-2010 12:14 PM |
timer question again | Elittdogg | Vizard | 3 | 10-18-2007 10:29 AM |
Timer speed | Jerry | Vizard | 1 | 12-08-2006 11:01 AM |