, subitem1),(u"sub item 2", subitem2)))]
示例代码: ---------------------------------------- import appuifw import e32 def exit_key_handler(): app_lock.signal() # create the callback functions for the application menu and its submenus def item1(): print "" round.set(u'item one was selected') def subitem1(): print "" round.set(u'subitem one was selected') def subitem2(): round.set(u'subitem two was selected') app_lock = e32.Ao_lock() round = appuifw.Text() round.set(u'press options') appuifw.app.screen='large' appuifw.app.body = round # create the application menu including submenus appuifw.app.menu = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1", subitem1), (u"sub item 2", subitem2)))] appuifw.app.exit_key_handler = exit_key_handler app_lock.wait() ---------------------------------------------
如何设定一个离开程序的键盘操作? 当你按下右键(即离开)时,离开的操作就会被执行。使用特别定义的一个函数,你就能定义在按下键时要做什么。
- def quit():
- appuifw.app.set_exit()
- app.exit_key_handler=quit
如何设定程序名称(标题)?
- appuifw.app.title = u"SMS sending"
如果有必要,如何来分配有效的对象? A facility called active object is used extensively on the Symbian OS to implement co-operative, non-preemptive scheduling within operating system threads. Preserving the responsiveness of the UI can be done with the help of active objects. This needs to be considered when designing the application logic. As a Python programmer, you typically need to take care of active objects as they relate to UI programming, and sockets. Can be tricky!
- # You need to import the e32 module
- import e32
- # create an instance of the active object
- app_lock = e32.Ao_lock()
- # starts a scheduler -> the script processes events (e.g. from the UI) until lock.signal() is
- # callled.
- app_lock.wait()
- # stops the scheduler
- app_lock.signal()
更详细的内容请查阅 API_Reference_for_Python.pdf 文档。
如何设置程序主体?
|