WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-02-2016, 01:18 PM
Eugene Eugene is offline
Member
 
Join Date: Jun 2016
Posts: 6
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)
Reply With Quote
  #2  
Old 07-07-2016, 03:54 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
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

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


All times are GMT -7. The time now is 03:15 AM.


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