Skip to content
Alessandro Febretti edited this page Sep 13, 2013 · 6 revisions

[[module omegaToolkit | Python-Reference#module-omegatoolkit]] wraps omegaTookit::ui::Menu

Represents a menu. Menus can contain buttons, sliders, checkboxes and sub menus

Methods

Method(s) Description
addItem(type) Adds an item to the menu. Type can be one of MenuItem.Button, MenuItem.Checkbox, MenuItem.Slider, MenuItem.SubMenu, MenuItem.Label, MenuItem.Image, MenuItem.Container
addButton(label, command) Convenience method for adding a button item and associating a command to it. Returns a reference to the created MenuItem
addSubMenu(label) Convenience method for adding a sub menu. Returns a reference to the created Menu
addLabel(text) Convenience method for adding a label. Returns a reference to the created MenuItem
addImage(image) Convenience method for adding an image. Returns a reference to the created MenuItem. the image is a PixelData object
addSlider(ticks, command) Convenience method for adding a slider. Returns a reference to the created MenuItem
addContainer() Convenience method for adding a container. Returns a reference to the created MenuItem
show() Displays the menu
hide() Hides the menu
isVisible() Returns True if this menu is currently visible
placeOnWand(event) When 3d menus are enabled, places the menu on the wand ray. The argument must be an event containing ray information, like a Wand or Pointer event.
getContainer() Gets the 'Container' widget containing the items of this menu

Examples

Add a bunch of buttons to the columns

Column 1

b1c1 = Button.create(c1) b2c1 = Button.create(c1)

Column 2

b1c2 = Button.create(c2) b2c2 = Button.create(c2) b3c2 = Button.create(c2)

Column 3

b1c3 = Button.create(c3) b2c3 = Button.create(c3) b3c3 = Button.create(c3)

setup navigation

vertical navigation for buttons will be set up automatically by the container.

we set horizontal navigation manually

Buttons on the first row

b1c1.setHorizontalNextWidget(b1c2) b1c2.setHorizontalPrevWidget(b1c1)

b1c2.setHorizontalNextWidget(b1c3) b1c3.setHorizontalPrevWidget(b1c2)

Buttons on the second row

b2c1.setHorizontalNextWidget(b2c2) b2c2.setHorizontalPrevWidget(b2c1)

b2c2.setHorizontalNextWidget(b2c3) b2c3.setHorizontalPrevWidget(b2c2)

Buttons on the third row

since the first column does not have a third row, prev navigation

from column 2 goes to the last button of column 1

b3c2.setHorizontalPrevWidget(b2c1)

b3c2.setHorizontalNextWidget(b3c3) b3c3.setHorizontalPrevWidget(b3c2)

Clone this wiki locally