View Single Post
  #2  
Old 11-13-2013, 06:15 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
Hi Saajaja,

The code below should do what you want. Note that the color of the screen will be skyblue instead of black (as stated in your question). Just change SKYBLUE to BLACK to change that. I think the problem is that the function you used immediately shows the input window, before drawing the scene again. By using the module viztask and schedule, you can make Vizard first draw one frame, and then do something else.

Code:
import viz
import vizinput
import vizact
import viztask

piazza = viz.add('piazza.osgb')
viz.go()

def getInput():
	# Blindfold.
	viz.MainScene.visible(0,viz.WORLD)
	viz.clearcolor(viz.SKYBLUE)
	yield viztask.waitFrame(1)
	
	# Ask for input
	input = ''
	while input == '':
		input = vizinput.input('Input something.')

	# Unblindfold.
	viz.MainScene.visible(1,viz.WORLD)
	viz.clearcolor(viz.BLACK)
	yield viztask.waitFrame(1)

def inputScreen():
	viztask.schedule(getInput)
	
vizact.onkeydown(' ', inputScreen)
Good luck!
Frank
Reply With Quote