Skip to content

Instantly share code, notes, and snippets.

@fireclawthefox
Last active March 10, 2020 21:54
Show Gist options
  • Save fireclawthefox/33e2f89465a5c82899855a999d6b4d1f to your computer and use it in GitHub Desktop.
Save fireclawthefox/33e2f89465a5c82899855a999d6b4d1f to your computer and use it in GitHub Desktop.
from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectOptionMenu import DirectOptionMenu
from direct.gui import DirectGuiGlobals as DGG
app = ShowBase()
# Open the item container below the menu
DirectOptionMenu(
scale=0.1,
items=["Open Below", "New", "Save", "Load", "Quit"],
pos=(base.a2dLeft, 0, base.a2dTop-0.08),
popupMenuLocation=DGG.BELOW)
# Open the item container right to the menu
# Also add enough items to have them scrollable (use mousewheel)
DirectOptionMenu(
scale=0.1,
items=["Open Right"] + ["Item {}".format(i) for i in range(50)],
pos=(base.a2dLeft, 0, 0),
popupMenuLocation=DGG.RIGHT)
# Open the item container left to the menu
DirectOptionMenu(
scale=0.1,
items=["Open Left"] + ["Item {}".format(i) for i in range(20)],
pos=(base.a2dRight-0.5, 0, 0),
popupMenuLocation=DGG.LEFT)
# Open the item container above the menu
DirectOptionMenu(
scale=0.1,
items=["Open Above"] + ["Item {}".format(i) for i in range(10)],
pos=(0, 0, base.a2dBottom),
popupMenuLocation=DGG.ABOVE)
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment