WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-18-2014, 04:24 AM
johnallen johnallen is offline
Member
 
Join Date: Nov 2013
Location: Canterbury, UK
Posts: 36
force screen refresh/update?

Hi,

I have

Code:
gScreenTextObj = viz.addText3D('',parent=viz.SCREEN, pos=( 0, 0, 0 ) )
and then later in a function that was called following a key press using vizact.onkeydown()

Code:
gScreenTextObj.message = "asdf"
Is there anyway I can force the screen update to take place (displaying the new text 'asdf')? At present it waits until the function ends and flow returns to the main loop.

thanks,

John
Reply With Quote
  #2  
Old 08-18-2014, 02:28 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you post example code that reproduces the issue?
Reply With Quote
  #3  
Old 08-19-2014, 01: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
  #4  
Old 08-19-2014, 07:02 AM
roobert roobert is offline
Member
 
Join Date: May 2014
Location: Pachuca, Hidalgo, México
Posts: 34
Send a message via Skype™ to roobert
I had the same problem, I solve it by starting the message variable in this way

Quote:
#starting variable
gScreenTextObj = vizinfo.add( "" )

#change the valor
def keyPressed_1():
global gScreenTextObj
gScreenTextObj.message('1 pressed')

vizact.onkeydown('1', keyPressed_1 )
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vizard exits full screen after 30 seconds derek Vizard 3 08-21-2014 12:02 PM
Displaying screen text in 3D (Oculus Rift) pjayaram Vizard 2 05-27-2014 08:06 PM
Screen Size and Scaling javadi Vizard 2 04-02-2013 05:56 PM
Attach a TexQuad to pit.osgb screen Ducky Vizard 1 01-17-2013 02:57 PM
position of html-file on screen active_world Vizard 1 05-16-2008 07:24 PM


All times are GMT -7. The time now is 01:20 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC