1、创建一个有3个选项的弹出菜单: 选项1显示: Python 选项2显示: Symbian 选项3显示: Mlab 2、运行脚本: 当用户从弹出菜单确定一个选项后,作出一个弹出通知的反馈(每个选项各有不同)。
 
事例代码: # Copyright (c) 2005 Jurgen Scheible # simple pop-up menu import appuifw L = [u"Python", u"Symbian", u"Mlab"] test = appuifw.popup_menu(L, u"Select + press OK:") if test == 0 : appuifw.note(u"Python, yeah", "info") if test == 1 : appuifw.note(u"Symbian, ok", "info") if test == 2 : appuifw.note(u"Mlab, cool students", "info")
代码说明: # Copyright (c) 2005 Jurgen Scheible # simple pop-up menu import appuifw # create a list with the content of the pop-up note L = [u"Python", u"Symbian", u"Mlab"] # create the pop-up menu including the list of content and a label # -> appuifw.popup_menu(list , label) test = appuifw.popup_menu(L, u"Select + press OK:") # the variable test holds the indicator which list item (position in the list) # has been selected # trigger some action (here we print something) if test == 0 : appuifw.note(u"Python, yeah", "info") if test == 1 : appuifw.note(u"Symbian, ok", "info") if test == 2 : appuifw.note(u"Mlab, cool students", "info")
|