WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 05-17-2016, 07:21 AM
jelly jelly is offline
Join Date: Feb 2016
Posts: 38
Question Vizard scheduler vs Python scheduler

I have some code that is scheduling beeps respective to the onset of the script, but it seems to run everything before Vizard can load and I think that is because Vizard may not understand the scheduler?

How can I use the viztask_schedule to achieve a comparable result, after Vizard loaded the environment?

import schedule
import time
from functools import partial
import viztask


## Cue sound ###
cue = viz.addAudio('cues\dong.wav') 
cueDuration = cue.getDuration() 

# my specified list of timings
times = [1.76493425, 3.10174059, 4.49576803, 10.99379224, 18.84178369]

# get the starting time
start = time.time()

# define a job, i.e. play beep sound and print smth
def job(t, start):
	print ('cue', ' - timing: ', t, ' - now: ', time.time()- start)
	# pop the job right away from, so it runs only once
	return schedule.CancelJob

def main():

	# for each time add what to do
	for t in times:
		# using partial so i can pass arguments to job
		schedule.every(t), t, start))
	# and run it inside a lop
	while True:
		# is just a list of jobs
		if not

Reply With Quote
Old 05-20-2016, 02:25 AM
Jeff Jeff is offline
WorldViz Team Member
Join Date: Aug 2008
Posts: 2,465
The viztask library is designed to control program flow. You can wait for time to elapse, an action, event, etc. before executing more code. If you have not done so yet, take a look at the viztask documentation in the reference section and the creating a task tutorial. Use the waittime command to wait for a set time.
Reply With Quote

scheduling, timing

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
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM
running multiple vizard scripts from python exhale Vizard 1 05-09-2005 05:35 AM

All times are GMT -7. The time now is 05:52 PM.

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