code/vexptoolbox/vrutil.py
def waitVRInstruction(msg='Text', title='Title', force_str=False, 
                      distance=2.5, height=None, billboard=True,
                      resolution=(1920, 1080), size=(1.92, 1.08),
                      font_size=50, keys=' ', controller=None):
    """ Display a world-locked instruction panel in VR and wait for key press.
    
    Instructions can be provided as string or read from an external text file. 
    Default is to show the panel at eye level at a distance of 2.5m. Depending on 
    text length, you might need to adjust the font and/or canvas size. 

    Args:
        msg (str): One of:
            - String: Message text to display on the instruction panel
            - Valid text file name: File content is read and set as message text
        title (str): Title bar text for instruction panel
        force_str (bool): If True, treat *msg* as text even if it is a vald file name
        distance (float): Z rendering distance from MainView (i.e., user's position)
        height (float): Panel vertical center (Y). Defaults to user's eye height.
        billboard (bool): If True, keep panel facing the viewer (default)
        resolution (tuple): Pixel resolution of virtual canvas as (x, y)
        size (tuple): Size of canvas object in meters as (x, y)
        keys (str): Key code(s) to dismiss message (see viztask.waitKeyDown)
        controller (sensor): Specify a controller sensor to also dismiss on button press
    
    Returns: Vizard keypress event upon key or button press
    """
    if not force_str:
        try:
            with open(msg, 'r') as tf:
                text = tf.read()
        except IOError: 
            text = msg
    else:
        text = msg

    hmd_pos = viz.MainView.getPosition()
    if height is None:
        height = hmd_pos[1]
    pos = [0, height, distance]
        
    text = addWorldLockedCanvas(msg=text,
                                title=title,
                                pos=pos,
                                billboard=billboard,
                                resolution=resolution,
                                size=size,
                                font_size=font_size)

    if controller is not None:
        event = yield viztask.waitAny([viztask.waitKeyDown(keys), viztask.waitSensorDown(controller, None)])
    else:
        event = yield viztask.waitKeyDown(keys)
    text.remove()
    viztask.returnValue(event)
 Display a world-locked instruction panel in VR and wait for key press.
    
    Instructions can be provided as string or read from an external text file. 
    Default is to show the panel at eye level at a distance of 2.5m. Depending on 
    text length, you might need to adjust the font and/or canvas size. 

    Args:
        msg (str): One of:
            - String: Message text to display on the instruction panel
            - Valid text file name: File content is read and set as message text
        title (str): Title bar text for instruction panel
        force_str (bool): If True, treat *msg* as text even if it is a vald file name
        distance (float): Z rendering distance from MainView (i.e., user's position)
        height (float): Panel vertical center (Y). Defaults to user's eye height.
        billboard (bool): If True, keep panel facing the viewer (default)
        resolution (tuple): Pixel resolution of virtual canvas as (x, y)
        size (tuple): Size of canvas object in meters as (x, y)
        keys (str): Key code(s) to dismiss message (see viztask.waitKeyDown)
        controller (sensor): Specify a controller sensor to also dismiss on button press
    
    Returns: Vizard keypress event upon key or button press
    
Display a world-locked instruction panel in VR and wait for key press.
Instructions can be provided as string or read from an external text file.
Default is to show the panel at eye level at a distance of 2.5m. Depending on
text length, you might need to adjust the font and/or canvas size.
Display a world - locked instruction panel in VR and wait for key press . Instructions can be provided as string or read from an external text file . Default is to show the panel at eye level at a distance of 2 . 5m . Depending on text length you might need to adjust the font and / or canvas size .
def waitVRInstruction(msg='Text', title='Title', force_str=False, 
                      distance=2.5, height=None, billboard=True,
                      resolution=(1920, 1080), size=(1.92, 1.08),
                      font_size=50, keys=' ', controller=None):
    if not force_str:
        try:
            with open(msg, 'r') as tf:
                text = tf.read()
        except IOError: 
            text = msg
    else:
        text = msg
    hmd_pos = viz.MainView.getPosition()
    if height is None:
        height = hmd_pos[1]
    pos = [0, height, distance]
    text = addWorldLockedCanvas(msg=text,
                                title=title,
                                pos=pos,
                                billboard=billboard,
                                resolution=resolution,
                                size=size,
                                font_size=font_size)
    if controller is not None:
        event = yield viztask.waitAny([viztask.waitKeyDown(keys), viztask.waitSensorDown(controller, None)])
    else:
        event = yield viztask.waitKeyDown(keys)
    text.remove()
    viztask.returnValue(event)
def waitVRInstruction ( msg = 'Text' , title = 'Title' , force_str = False , distance = 2.5 , height = None , billboard = True , resolution = ( 1920 , 1080 ) , size = ( 1.92 , 1.08 ) , font_size = 50 , keys = ' ' , controller = None ) : if not force_str : try : with open ( msg , 'r' ) as tf : text = tf . read ( ) except IOError : text = msg else : text = msg hmd_pos = viz . MainView . getPosition ( ) if height is None : height = hmd_pos [ 1 ] pos = [ 0 , height , distance ] text = addWorldLockedCanvas ( msg = text , title = title , pos = pos , billboard = billboard , resolution = resolution , size = size , font_size = font_size ) if controller is not None : event = yield viztask . waitAny ( [ viztask . waitKeyDown ( keys ) , viztask . waitSensorDown ( controller , None ) ] ) else : event = yield viztask . waitKeyDown ( keys ) text . remove ( ) viztask . returnValue ( event )
Display a world-locked instruction panel in VR and wait for key press.
Display a world - locked instruction panel in VR and wait for key press .
""" Display a world-locked instruction panel in VR and wait for key press.
    
    Instructions can be provided as string or read from an external text file. 
    Default is to show the panel at eye level at a distance of 2.5m. Depending on 
    text length, you might need to adjust the font and/or canvas size. 

    Args:
        msg (str): One of:
            - String: Message text to display on the instruction panel
            - Valid text file name: File content is read and set as message text
        title (str): Title bar text for instruction panel
        force_str (bool): If True, treat *msg* as text even if it is a vald file name
        distance (float): Z rendering distance from MainView (i.e., user's position)
        height (float): Panel vertical center (Y). Defaults to user's eye height.
        billboard (bool): If True, keep panel facing the viewer (default)
        resolution (tuple): Pixel resolution of virtual canvas as (x, y)
        size (tuple): Size of canvas object in meters as (x, y)
        keys (str): Key code(s) to dismiss message (see viztask.waitKeyDown)
        controller (sensor): Specify a controller sensor to also dismiss on button press
    
    Returns: Vizard keypress event upon key or button press
    """
msg
One of:
String: Message text to display on the instruction panel
Valid text file name: File content is read and set as message text
One of : String : Message text to display on the instruction panel Valid text file name : File content is read and set as message text
title
Title bar text for instruction panel
Title bar text for instruction panel
force_str
If True, treat *msg* as text even if it is a vald file name
If True treat * msg * as text even if it is a vald file name
distance
Z rendering distance from MainView
Z rendering distance from MainView
height
Panel vertical center (Y). Defaults to user's eye height.
Panel vertical center ( Y ) . Defaults to user ' s eye height .
user's eye height
billboard
If True, keep panel facing the viewer (default)
If True keep panel facing the viewer ( default )
resolution
Pixel resolution of virtual canvas as (x, y)
Pixel resolution of virtual canvas as ( x y )
size
Size of canvas object in meters as (x, y)
Size of canvas object in meters as ( x y )
font_size
keys
Key code(s) to dismiss message
Key code ( s ) to dismiss message
controller
Specify a controller sensor to also dismiss on button press
Specify a controller sensor to also dismiss on button press