View Single Post
Old 10-21-2011, 06:46 PM
vasiliys vasiliys is offline
Join Date: Oct 2011
Posts: 3
Simplest script not working

I'm a bit dumbfounded by a tiny script not working the way I would expect:

This simple script should:
1. Turn the screen white on a 'w' press.
2. Turn the screen black on a 'b' press.
3. Turn the screen white, wait half a seconds and turn it black on a 's' press.

For some reason it will not turn it white on the 's' , though it does call the appropriate functions. I have no more ideas on what the issue could be. I hope someone here knows.

I have commented out all code irrelevant to the problem and it persists.

#import sys
import viz
#import vizparallel


def whiteScreen():
	viz.clearcolor(256, 256, 256)

vizact.onkeydown('w', whiteScreen)

def blackScreen():
	viz.clearcolor(0, 0, 0)

vizact.onkeydown('b', blackScreen)

def sendSignal():

vizact.onkeydown('s', sendSignal)

def sendParallel(signalCode = 24, delay = 0.5, port = 0x0378):
#	print('Sending code ' + str(signalCode) + ' for ' + str(delay) + ' seconds on port ' + str(port) + ' at tick ' + str(viz.tick()))
#	vizparallel.write( signalCode, port )
#	print('Clearing with a zero at tick ' + str(viz.tick()))
#	vizparallel.write( 0, port )

def sleep(delay):
	start = viz.tick()
	while viz.tick() - start < delay: pass
	return viz.tick() - start
Reply With Quote