#1
|
|||
|
|||
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. Zhi |
#2
|
|||
|
|||
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:
Code:
import viz import vizact import viztask viz.go() model = viz.add('logo.ive',pos=(0,1,4)) model.addAction(vizact.spin(0,1,0,90)) def GetInputTask(): d = viz.Data() yield viztask.waitDirector(viz.input,'Enter string:',data=d) print d.returnValue viztask.schedule(GetInputTask()) 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. |
#3
|
|||
|
|||
Thank you for your suggestions.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Controlling User Input | ohad | Vizard | 1 | 03-15-2010 06:16 PM |
Question about input from virtual keyboard. | yyang | Vizard | 4 | 12-23-2008 01:25 PM |
Timer vs. Keyboard input | Wenamun | Vizard | 1 | 01-23-2006 10:04 PM |
User Input | Hodge1620 | Vizard | 2 | 11-17-2005 07:58 AM |
user input problem | Jerry | Vizard | 1 | 11-16-2005 04:15 PM |