questions on how to create a form
can someone teach me how to create a form used to gather infomation entered by a user?
I need to do it in this way. If I pressed a key such as 'p', the animation would be paused. Then the form comes up. After the form is filled in, I press a 'submit' button to pass them to somewhere. I already tried to use vizinfo and vizmenu. but they can just show a list , not a real form like what we did in the Microsoft Office. Thanks a lot:confused::confused: |
You can try using the undocumented vizdlg module for displaying forms. It allows more advanced form layouts and dialog like components. Here is sample code that creates a custom dialog/form and displays it when the 'p' key is pressed:
Code:
import viz |
Wow.....many thanks. I really appreciate it. This is exactly what I considered. If the vizard could create many complex models, there should be some ways to make tables. However, could you plz tell me how I can get the specific use of this module? I just tried your sample code and part of my purpose already was achieved. As you mentioned , something more advanced is allowed. How can I do it? Since this module is not documented , it's really hard to know its exact usage which is vital to me.
Regards |
You will need to be more specific about what you are trying to accomplish. Do you have a screenshot of a form you would like to mimic?
|
http://sz.photo.store.qq.com/http_im...f03c038e4cb93e
I finally got a place to upload the form in jpg format. This is basically what I wanna do. In addition , as the example provided previously, I also need the animation paused when I presss the "P" key. Is there an easy way to do this? I really need this "pause" action. Thanks for help.:o:o |
What kind of animation are you talking about? (vizact animation, avatar animation, etc..)
|
Hi, my work is about avatar animation.
|
You can use the following command to pause an avatar:
Code:
avatar.speed(0) Code:
avatar.speed(1) |
How would I rewrite this so that the vizdlg is not in a yield statement. I try calling form.show() directly and nothing is displayed. I want to gather some user information then loop on a set of inputs. I would like to use vizdlg for the control I have over the form.
|
The show method just sets the dialog visible, waits for either the accept or cancel button to be pressed, then hides the dialog. If you do not want to use a task, then you can manually perform these steps. Here is the code for the show command:
Code:
def show(self): |
When I add the yield statement I lose visibility of the form. I don't manually change the visibility. What gives?
|
You should not be using yield statements if you are not using tasks. Here is a sample script that displays a dialog without using tasks. Use the spacebar to toggle the visibility of the dialog.
Code:
import viz |
Thanks, This is what I ended up with, but I don't want to display the gallery until I hit accept. I want to wait for the dialog to be done. Say the dialog asks for the user to make a button choice then accept before the gallery is displayed.
import viz import vizdlg viz.go() #Create empty dialog dlg = vizdlg.Dialog(title='Dialog title') #Link dialog to center of window viz.link(viz.CenterCenter,dlg) #Toggle dialog visibility when spacebar is pressed vizact.onkeydown(' ',dlg.visible,viz.TOGGLE) # Look for the Accept button to be pressed. vizact.onbuttondown(dlg.accept,dlg.visible,viz.TOG GLE) viz.add('gallery.ive') |
Is there a specific reason you don't want to use tasks? They are made for these type of cases where you want a linear flow of operations. Either way, here is how you would handle this without tasks. The code sets up a callback for the accept button and calls a function when it is clicked.
Code:
import viz |
I am new to this type of programming. If you add a
print 'The End' at the end of the script the print statement is executed. This tells me execution continues. So I must not be approaching this the right way. What I am trying to do is prompt a user for his name. He enters it using a onscreen keyboard I have coded. Once the user has entered their name they loop over a sequence of dialogs for a set amount of time. In my code the other dialogs appear since the execution continues. |
If your print statement is in the global scope then it will be executed during the script loading. All that sample code does is register a callback for when the accept button of the dialog is clicked and calls the specified function. If you need to display a series of dialogs sequentially, then I highly recommend using tasks. Using a callback approach will become very difficult once you have more than one dialog.
|
All times are GMT -7. The time now is 09:09 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC