WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   User keyboard input without halting the program (

Zhi 06-22-2011 06:48 AM

User keyboard input without halting the program
Hi all,

I am wondering how to get a string input from the keyboard without halting the program. The viz.input pops out an dialog and halts the program. The vizinfo box seems unable to get keyboard input at all. Is there a simple way in Vizard or Python to get a string input from the keyboard, similar to the "gets()" function in C language. While the user inputting the string, there is no dialog box popping out and no halting of the program.


farshizzo 06-22-2011 09:25 AM

You should be able to call the viz.input command in a separate thread to prevent it from halting the main graphics loop. Here is a sample:

import viz
import vizact
import viztask

model = viz.add('logo.ive',pos=(0,1,4))

def GetInputTask():

        d = viz.Data()
        yield viztask.waitDirector(viz.input,'Enter string:',data=d)

        print d.returnValue


You could also add a textbox to the vizinfo box to get keyboard input.

If you ever upgrade to Vizard 4.0, it comes with a new vizhtml module that allows you to collect input from arbitrary HTML forms.

Zhi 06-23-2011 12:53 PM

Thank you for your suggestions.

All times are GMT -7. The time now is 04:42 AM.

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