Here is another way to do the same thing, just shows previous levels.
if event.popupTrigger:
# Create the main menu
names = []
funcs = []
##############################################################
# Create the first sub menu
subnames = []
subfuncs = []
##############################################################
# Add some functions to this menu
def sayHello(event):
import system
system.gui.messageBox("Hello World")
subnames.append("Hello")
subfuncs.append(sayHello)
def sayGoodbye(event):
import system
system.gui.messageBox("Goodbye Cruel World")
subnames.append("Goodbye")
subfuncs.append(sayGoodbye)
##############################################################
# create English sub menu
names.append("English")
funcs.append([subnames,subfuncs])
# Add a seperator
names.append(None)
funcs.append(None)
##############################################################
# Create another sub menu
subnames = []
subfuncs = []
##############################################################
# Add functions to this submenu
def sayHello(event):
import system
system.gui.messageBox("Guten Tag")
subnames.append("Guten Tag")
subfuncs.append(sayHello)
def sayGoodbye(event):
import system
system.gui.messageBox("Guten Abend")
subnames.append("Guten Abend")
subfuncs.append(sayGoodbye)
names.append("German")
funcs.append([subnames,subfuncs])
##############################################################
# create the popup menu
menu = system.gui.createPopupMenu(names, funcs)
menu.show(event)
Cheers,
Chris