1、创建一个有三个选项的应用程序菜单,分别为 “one” , “tow” 和 “send message” 2、当选择一,二两个选项时,显示一个弹出通知:
1) 弹出消息显示 “Foo”,当选择第一个选项时 2)弹出消息显示 “Outch”,当选择第二个选项时
3、当选择第三个选项时,在显示弹出通知 “message sent” 之后发送消息“greetings from Heaven”给另外一个移动电话。 示例代码: # 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 import messaging
def exit_key_handler(): app_lock.signal() def item1(): appuifw.note(u"Foo", "info")
def item2(): appuifw.note(u"Outch", "info")
def item3(): nbr1 = "3456" # add here a propper mobile number txt = u"Greetings from Heaven" messaging.sms_send(nbr1, txt) appuifw.note(u"Message sent", "info")
app_lock = e32.Ao_lock()
appuifw.app.menu = [(u"one", item1), (u"two", item2), (u"send message", item3)]
appuifw.app.exit_key_handler = exit_key_handler app_lock.wait() |