应用程序菜单是单一个程序运行的时候打开”options button”(键盘左边的选择键)所弹出的一个菜单界面。
- 创建一个有”one”和”two”两个选项的应用程序菜单
- 当选择不同选项时显示弹出通知:
- 显示”Foo”当选择第一个时
- 显示”Outh”当选择第二个时
示例文件: # Copyright (c) 2006 Jurgen Scheible
# this script lets you create a simple application menu
# NOTE:
# press the options key in order to open the applicaion menu
# when running the script!
import appuifw
import e32
def exit_key_handler():
app_lock.signal()
def item1():
appuifw.note(u"Foo", "info")
def item2():
appuifw.note(u"Outch", "info")
app_lock = e32.Ao_lock()
appuifw.app.menu = [(u"one", item1),
(u"two", item2)]
appuifw.app.exit_key_handler = exit_key_handler
app_lock.wait() 说明文档:
# Copyright (c) 2006 Jurgen Scheible
# this script lets you create a simple application menu
# NOTE:
# press the options key in order to open the applicaion menu
# when running the script!
# imort appuifw and the e32 modules
import appuifw
import e32
# define an exit handler
def exit_key_handler():
app_lock.signal()
# create the "callback functions" for the application menu
def item1():
appuifw.note(u"Foo", "info")
def item2():
appuifw.note(u"Outch", "info")
# create an active object
app_lock = e32.Ao_lock()
# create the application menu include the selectable options (one, two)
# and the related callback functions (item1, item2)
appuifw.app.menu = [(u"one", item1),
(u"two", item2)]
appuifw.app.exit_key_handler = exit_key_handler
# start a scheduler
app_lock.wait()
   |