Is there a smarter way to do the keyboard interrupt in the following
example?
I don't really need the window but if I make it invisible by uncommenting
the 5th line the program doesn't work as before.
Yours,
Poul Riis
from visual import *
from time import *
scene.width=25
scene.height=25
#scene.visible=0
oldreadkey=0
for i in range(1,10):
readkey=scene.kb.keys
print i,readkey
if readkey!=0:
break
sleep(0.25)
print "Once again..."
oldreadkey=readkey
for i in range(1,10):
readkey=scene.kb.keys
print i,readkey
if readkey>oldreadkey:
break
sleep(0.25)
print "Yet another time..."
oldreadkey=readkey
for i in range(1,10):
readkey=scene.kb.keys
print i,readkey
if readkey>oldreadkey:
break
sleep(0.25)
print "The end"
|