PDA

View Full Version : Drop Down menu


M@rcello
06-08-2016, 08:50 AM
Hello to everyone,
I am trying to build a drop down menu in vizard.
This is the code:
import viz
import vizdlg

viz.go()

#Create main menu object
import vizmenu
menu = vizmenu.add()
#Align the menu in the enter of the top of the screen.
menu.setAlignment( vizmenu.CENTER )
#Add two pop-downs menus within the main menu.
AppearanceMenu = menu.add( 'Appearance' )
Ball1Menu = menu.add( 'Ball 1' )


#Add a droplist to one of the pop-downs.
themeDropDown = AppearanceMenu.add( viz.DROPLIST, 'Theme' )
themeDropDown.addItems( ['Default','Dark','Green'] )

#Add sub-menu under the Ball1 menu and put radio buttons in it.
Ball1ColorMenu = Ball1Menu.add( vizmenu.MENU, 'Color' )
Ball1Red = Ball1ColorMenu.add( viz.RADIO, 0, 'Red' )
Ball1White = Ball1ColorMenu.add( viz.RADIO, 0, 'White' )
Ball1Blue = Ball1ColorMenu.add( viz.RADIO, 0, 'Blue' )
#Add another sub-menu to the Ball1 menu for a slider.
Ball1SizeSlider = Ball1Menu.add( viz.SLIDER, 'Size' )


In the menu i can set the color and size of the ball. I would like to have a button to confirm the properties and insert immediately a ball with that color and size.

Thanks in advance!

Jeff
06-14-2016, 03:45 AM
You could add a button or button label:

button = Ball1Menu.add(viz.BUTTON,'Submit')
button.setScale([2]*3)
buttonLabel = Ball1Menu.add(viz.BUTTON_LABEL,'Submit')