首 页 | 新 闻 | Symbian | Android| Windows Mobile | J2ME | 下载中心 | 游戏策划招聘与求职 | 购书指南 | 视频教程
您现在的位置: 开发视界 >> Symbian >> Symbian开发 >> 正文
S60 Python 编程指南——如何创建pys60应用程序
作者:佚名    文章来源:本站原创    更新时间:2006-12-16 11:29:57
, 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()
---------------------------------------------
  • 如何设定一个离开程序的键盘操作?
    当你按下右键(即离开)时,离开的操作就会被执行。使用特别定义的一个函数,你就能定义在按下键时要做什么。

    1. def quit():
    2.         appuifw.app.set_exit() 
    3. app.exit_key_handler=quit
  • 如何设定程序名称(标题)?
    1. 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!

    1. # You need to import the e32 module
    2.  import e32 
    3. # create an instance of the active object
    4.  app_lock = e32.Ao_lock() 
    5. # starts a scheduler -> the script processes events (e.g. from the UI) until lock.signal() is
    6.  # callled.
    7.  app_lock.wait()
    8. # stops the scheduler
    9.  app_lock.signal()

    更详细的内容请查阅 API_Reference_for_Python.pdf 文档。

  • 如何设置程序主体?
    1. # body as Listbox:
    2.  appuifw.app.body = appuifw

      上一页  [1] [2] [3] [4] 下一页

  • 相关文章:
    小试Python for Symbian
    为什么recognizer 导致lock up
    S60 Python 编程指南——程序菜单练习(2)
    S60 Python 编程指南——程序菜单练习(1)
    S60 Python 编程指南——信息标签
    在程序启动后先弹出确定使用文字页面,然后确定后继续运行,怎么做?
    编写异常安全的C++代码
    OPL 速成教程(二)
     

    站点地图 | 加入收藏 | 联系站长 | 广告服务 |
    QQ:280529124  Tel:0592-8271361 辽ICP备05021703号