首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian >> Symbian开发 >> 文章正文
S60 Python 编程指南——程序菜单练习(1)
作者:朱珠    文章来源:http://fred.webcan.cn/weblog/    更新时间:2007-2-2 11:23:19

应用程序菜单是单一个程序运行的时候打开”options button”(键盘左边的选择键)所弹出的一个菜单界面。

  1. 创建一个有”one”和”two”两个选项的应用程序菜单
  2. 当选择不同选项时显示弹出通知:
    1. 显示”Foo”当选择第一个时
    2. 显示”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()
Pic OnePic TwoPic Three
相关文章:
小试Python for Symbian
MMI of UIQ (一)
Menu中加入水平分隔线
为什么recognizer 导致lock up
S60 Python 编程指南——程序菜单练习(2)
S60 Python 编程指南——信息标签
S60 Python 编程指南——如何创建pys60应用程序
编写异常安全的C++代码