View Single Post
  #3  
Old 08-19-2014, 02:49 AM
johnallen johnallen is offline
Member
 
Join Date: Nov 2013
Location: Canterbury, UK
Posts: 36
Quote:
Originally Posted by Jeff View Post
Can you post example code that reproduces the issue?
pressing '1' displays a message, pressing '2' clears it, however it blocks waiting for the keyboard input on the viz.input() call.

i would like to flush the screen update before blocking for the keyboard input if possible.

Thanks,
John

Code:
import viz, vizconnect, vizact, vizinput, viztask

viz.setMultiSample(4)
gScreenTextObj = None

def keyPressed_1():
    global gScreenTextObj
    gScreenTextObj.message("1 pressed")

def keyPressed_2():
    global gScreenTextObj
    gScreenTextObj.message("") # try to clear the message
    gCurrentPID = int( vizinput.input("Enter ID : "))
    gGAB = vizinput.choose( "Gender: ", ['Male', 'Female'] )

def exitExperiment():
    viz.quit()
    
def vizconn_kbd_mouse():
	vizconnect.go('vizconnect_kbd_mouse_monitor.py')

def experiment():
    global gTracker, gScreenTextObj

    vizconn_kbd_mouse()
    gTracker = vizconnect.getTracker('mouse_and_keyboard_walking')
    room = viz.add('room4.osgb')
    
    vizact.onkeydown('x', exitExperiment )
    vizact.onkeydown('1', keyPressed_1 )
    vizact.onkeydown('2', keyPressed_2 )
    
    gScreenTextObj = viz.addText3D('',parent=viz.SCREEN, pos=( 0, 0, 0 ) ) #write on screen messages here
    
# We've defined all our functions, now lets start our experiment!
viztask.schedule(experiment)
Reply With Quote