- 浏览: 1010398 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (367)
- JavaScript (23)
- Java (60)
- Python (41)
- 其他 (36)
- SQL (4)
- 开发工具 (26)
- Linux (15)
- AJAX (6)
- Cache (3)
- 正则 (4)
- 架构 (9)
- 手机 (3)
- MySQL (4)
- Android (115)
- vps (1)
- 网站 (4)
- scale (3)
- 搜索引擎 (3)
- iPhone (2)
- hessian (1)
- hessdroid (1)
- 411 (1)
- jstat (1)
- gc (1)
- gallery (1)
- 惯性 (1)
- eclipse (1)
- mac wget error (1)
- miui file explorer 无用 解决办法 (1)
- vim (1)
最新评论
-
qingyezhangluo:
哎。楼主您既然是分享代码的为什么要加密的呢?而且问你密码还不回 ...
android应用换皮肤(转) -
MagicError:
kavoe 写道下载文件有密码。。。。
http抓包工具 -
knightdf:
我先试下再来
JAVA的RAS加密例子 -
kavoe:
下载文件有密码。。。。
http抓包工具 -
changanfounder:
hmc1985 写道setCallbackDuringFlin ...
android gallery滑动惯性问题
S60 Python 编程指南—— 如何创建一个应用程序
关键字: s60 python
1,插入所有需要的模块
2,设定屏幕大小 (normal, large, full)
3,编写你程序的逻辑代码
4,创建一个程序菜单(如果有必要)
5,设定一个离开的按键
6,设定程序标题
7,如果有必要,分配活动的对象
8,设定程序主题(文字,背景,列表或什么都没有)
9,创建一个恰当的主循环体
1,如何装如所需要的所有模块?
import appuifw import e32
2,如何设定屏幕大小?
- # screen has 3 different values:
- appuifw.app.screen='normal' #(a normal screen with title pane and softkeys)
- appuifw.app.screen='large' #(only softkeys visible)
- appuifw.app.screen='full' #(a full screen)
# screen has 3 different values: appuifw.app.screen='normal' #(a normal screen with title pane and softkeys) appuifw.app.screen='large' #(only softkeys visible) appuifw.app.screen='full' #(a full screen)
示例代码:
---------------------------------
- import appuifw
- import e32
- def exit_key_handler():
- app_lock.signal()
- round = appuifw.Text()
- round.set(u'hello')
- # put the application screen size to full screen
- appuifw.app.screen='full' #(a full screen)
- # other options:
- #appuifw.app.screen='normal' #(a normal screen with title pane and softkeys)
- #appuifw.app.screen='large' #(only softkeys visible)
- app_lock = e32.Ao_lock()
- appuifw.app.body = round
- appuifw.app.exit_key_handler = exit_key_handler
- app_lock.wait()
import appuifw import e32 def exit_key_handler(): app_lock.signal() round = appuifw.Text() round.set(u'hello') # put the application screen size to full screen appuifw.app.screen='full' #(a full screen) # other options: #appuifw.app.screen='normal' #(a normal screen with title pane and softkeys) #appuifw.app.screen='large' #(only softkeys visible) app_lock = e32.Ao_lock() appuifw.app.body = round appuifw.app.exit_key_handler = exit_key_handler app_lock.wait()
3,如何创建你程序的逻辑结构?
这个完整的指南就是关于这个问题的…… 你必须确定一些逻辑结构使你的程序运行起来,任何逻辑结构都有可能!
4,如何创建一个应用程序菜单?
一个应用程序菜单使用左边的软按键并使得在你的应用程序运行时总是更够被使用。一个应用程序菜单也能包含子菜单。
- # create the callback functions that shall be executed when when selecting an item in
- # the menu:
- def item1():
- print "item one"
- def subitem1():
- print "subitem one"
- def subitem2():
- print "subitem two"
- # create the menu using appuifw.app.menu[(title, callback1), (title, (subtitle, callback2))]
- appuifw.app.menu = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1"
- , subitem1),(u"sub item 2", subitem2)))]
# create the callback functions that shall be executed when when selecting an item in # the menu: def item1(): print "item one" def subitem1(): print "subitem one" def subitem2(): print "subitem two" # create the menu using appuifw.app.menu[(title, callback1), (title, (subtitle, callback2))] appuifw.app.menu = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1" , 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()
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()
5,如何设定一个离开程序的键盘操作?
当你按下右键(即离开)时,离开的操作就会被执行。使用特别定义的一个函数,你就能定义在按下键时要做什么。
def quit(): appuifw.app.set_exit() app.exit_key_handler=quit
6,如何设定程序名称(标题)?
appuifw.app.title = u"SMS sending"
7,如果有必要,如何来分配有效的对象?
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()
# 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()
8,如何设置程序主体?
# body as Listbox: appuifw.app.body = appuifw.Listbox(entries,shout)
示例代码:
------------------------------------------------
- import appuifw
- import e32
- def exit_key_handler():
- app_lock.signal()
- # define a callback function
- def shout():
- index = lb.current()
- print index
- print entries[index]
- # create your content list of your listbox including the icons to be used for each entry
- entries = [u"Signal",u"Battery"]
- lb = appuifw.Listbox(entries,shout)
- # create an Active Object
- app_lock = e32.Ao_lock()
- # create an instance of appuifw.Listbox(), include the content list "entries" and the callback function "shout"
- # and set the instance of Listbox now as the application body
- appuifw.app.body = lb
- appuifw.app.exit_key_handler = exit_key_handler
- app_lock.wait()
import appuifw import e32 def exit_key_handler(): app_lock.signal() # define a callback function def shout(): index = lb.current() print index print entries[index] # create your content list of your listbox including the icons to be used for each entry entries = [u"Signal",u"Battery"] lb = appuifw.Listbox(entries,shout) # create an Active Object app_lock = e32.Ao_lock() # create an instance of appuifw.Listbox(), include the content list "entries" and the callback function "shout" # and set the instance of Listbox now as the application body appuifw.app.body = lb appuifw.app.exit_key_handler = exit_key_handler app_lock.wait()
# body as Text: appuifw.app.body = appuifw.Text(u'hello')
示例代码:
------------------------------------------------
- import appuifw
- import e32
- def exit_key_handler():
- app_lock.signal()
- # create an instance of appuifw.Text()
- round = appuifw.Text()
- # change the style of the text
- round.style = appuifw.STYLE_UNDERLINE
- # set the text to 'hello'
- round.set(u'hello')
- # put the screen size to full screen
- appuifw.app.screen='full'
- # create an Active Object
- app_lock = e32.Ao_lock()
- # set the application body to Text
- # by handing over "round" which is an instance of appuifw.Text() as definded above
- appuifw.app.body = round
- appuifw.app.exit_key_handler = exit_key_handler
- app_lock.wait()
import appuifw import e32 def exit_key_handler(): app_lock.signal() # create an instance of appuifw.Text() round = appuifw.Text() # change the style of the text round.style = appuifw.STYLE_UNDERLINE # set the text to 'hello' round.set(u'hello') # put the screen size to full screen appuifw.app.screen='full' # create an Active Object app_lock = e32.Ao_lock() # set the application body to Text # by handing over "round" which is an instance of appuifw.Text() as definded above appuifw.app.body = round appuifw.app.exit_key_handler = exit_key_handler app_lock.wait()
- # body as Canvas:
- appuifw.app.body=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
# body as Canvas: appuifw.app.body=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
示例代码:
---------------------------------------------
- # Copyright (c) 2005 Jurgen Scheible
- # This script draws different shapes and text to the canvas
- import appuifw
- from appuifw import *
- import e32
- # import graphics
- from graphics import *
- # create an exit handler
- def quit():
- global running
- running=0
- appuifw.app.set_exit()
- # set the screen size to large
- appuifw.app.screen='large'
- # define an initial image (white)
- img=Image.new((176,208))
- # add different shapes and text to the image
- # coord. sequence x1,x2,y1,y2
- img.line((20,20,20,120),0xff00ee)
- img.rectangle((40,60,50,80),0xff0000)
- img.point((50.,150.),0xff0000,width=40)
- img.ellipse((100,150,150,180),0x0000ff)
- img.text((100,80), u'hello')
- # define your redraw function (that redraws the picture on and on)
- # in this case we redraw the image named img using the blit function
- def handle_redraw(rect):
- canvas.blit(img)
- running=1
- # define the canvas, include the redraw callback function
- canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)
- # set the app.body to canvas
- appuifw.app.body=canvas
- app.exit_key_handler=quit
- # create a loop to redraw the the screen again and again until the exit button is pressed
- while running:
- # redraw the screen
- handle_redraw(())
- # yield needs to be here in order that key pressings can be noticed
- e32.ao_yield()
# Copyright (c) 2005 Jurgen Scheible # This script draws different shapes and text to the canvas import appuifw from appuifw import * import e32 # import graphics from graphics import * # create an exit handler def quit(): global running running=0 appuifw.app.set_exit() # set the screen size to large appuifw.app.screen='large' # define an initial image (white) img=Image.new((176,208)) # add different shapes and text to the image # coord. sequence x1,x2,y1,y2 img.line((20,20,20,120),0xff00ee) img.rectangle((40,60,50,80),0xff0000) img.point((50.,150.),0xff0000,width=40) img.ellipse((100,150,150,180),0x0000ff) img.text((100,80), u'hello') # define your redraw function (that redraws the picture on and on) # in this case we redraw the image named img using the blit function def handle_redraw(rect): canvas.blit(img) running=1 # define the canvas, include the redraw callback function canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw) # set the app.body to canvas appuifw.app.body=canvas app.exit_key_handler=quit # create a loop to redraw the the screen again and again until the exit button is pressed while running: # redraw the screen handle_redraw(()) # yield needs to be here in order that key pressings can be noticed e32.ao_yield()
9,如何创建一个主循环?
把主循环放置在需要反复运行的代码位置
1. running = 1 2. while running: 3. # #e.g. redraw the screen: 4. handle_redraw(())
示例代码:
---------------------------------
- # Copyright (c) 2006 Jurgen Scheible
- # Application skeleton (no main loop)
- import appuifw
- import e32
- appuifw.app.screen='large'
- # create your application logic ...
- def item1():
- print "hello"
- def subitem1():
- print "aha"
- def subitem2():
- print "good"
- appuifw.app.menu = [(u"item 1", item1),
- (u"Submenu 1", ((u"sub item 1", subitem1),
- (u"sub item 2", subitem2)))]
- def exit_key_handler():
- app_lock.signal()
- appuifw.app.title = u"drawing"
- app_lock = e32.Ao_lock()
- appuifw.app.body = ...
- appuifw.app.exit_key_handler = exit_key_handler
- app_lock.wait()
- """ description:
- # 1. import all modules needed
- import appuifw
- import e32
- # 2. set the screen size to large
- appuifw.app.screen='large'
- # 3. create your application logic ...
- # e.g. create all your definitions (functions) or classes and build instances of them or call them etc.
- # ...... application logic ....
- # 4. create the application menu including submenus
- # create the callback functions for the application menu and its submenus
- def item1():
- print ""
- round.set(u'item one was selected')
- def item1():
- print "hello"
- def subitem1():
- print "aha"
- def subitem2():
- print "good"
- appuifw.app.menu = [(u"item 1", item1),
- (u"Submenu 1", ((u"sub item 1", subitem1),
- (u"sub item 2", subitem2)))]
- # 5. create and set an exit key handler
- def exit_key_handler():
- app_lock.signal()
- # 6. set the application title
- appuifw.app.title = u"drawing"
- # 7. crate an active objects
- app_lock = e32.Ao_lock()
- # 8. set the application body
- appuifw.app.body = ...
- # no main loop
- appuifw.app.exit_key_handler = exit_key_handler
- app_lock.wait()
- """
# Copyright (c) 2006 Jurgen Scheible # Application skeleton (no main loop) import appuifw import e32 appuifw.app.screen='large' # create your application logic ... def item1(): print "hello" def subitem1(): print "aha" def subitem2(): print "good" appuifw.app.menu = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1", subitem1), (u"sub item 2", subitem2)))] def exit_key_handler(): app_lock.signal() appuifw.app.title = u"drawing" app_lock = e32.Ao_lock() appuifw.app.body = ... appuifw.app.exit_key_handler = exit_key_handler app_lock.wait() """ description: # 1. import all modules needed import appuifw import e32 # 2. set the screen size to large appuifw.app.screen='large' # 3. create your application logic ... # e.g. create all your definitions (functions) or classes and build instances of them or call them etc. # ...... application logic .... # 4. create the application menu including submenus # create the callback functions for the application menu and its submenus def item1(): print "" round.set(u'item one was selected') def item1(): print "hello" def subitem1(): print "aha" def subitem2(): print "good" appuifw.app.menu = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1", subitem1), (u"sub item 2", subitem2)))] # 5. create and set an exit key handler def exit_key_handler(): app_lock.signal() # 6. set the application title appuifw.app.title = u"drawing" # 7. crate an active objects app_lock = e32.Ao_lock() # 8. set the application body appuifw.app.body = ... # no main loop appuifw.app.exit_key_handler = exit_key_handler app_lock.wait() """
2. with mainloop (if suitable)
- # Copyright (c) 2006 Jurgen Scheible
- # Application skeleton with main loop (while loop)
- import appuifw
- import e32
- appuifw.app.screen='large'
- # create your application logic ...
- running=1
- def quit():
- global running
- running=0
- app.exit_key_handler=quit
- appuifw.app.title = u"drawing"
- appuifw.app.body= ...
- while running:
- # handle_redraw(())
- e32.ao_sleep(0.5)
- """ description:
- # 1. import all modules needed
- import appuifw
- import e32
- # 2. set the screen size to large
- appuifw.app.screen='large'
- # 3. create your application logic ...
- # e.g. create all your definitions (functions) or classes and build instances of them or call them etc.
- # ...... application logic ....
- running=1
- # 4. no application menu here neccessary
- # 5. create and set an exit key handler: when exit ley is pressed, the main loop stops going (because the variable running will be put to 0=
- def quit():
- global running
- running=0
- app.exit_key_handler=quit
- # 6. set the application title
- appuifw.app.title = u"drawing"
- # 7. no active objects needed
- # 8. set the application body
- appuifw.app.body= ...
- # 9. create a main loop (e.g. redraw the the screen again and again)
- while running:
- # #put here things that need to be run through again and again
- # #e.g. redraw the screen:
- # handle_redraw(())
- # yield needs to be here e.g. in order that key pressings can be noticed
- e32.ao_yield()
- """
发表评论
-
python图形处理库Python Imaging Library (PIL)简介及安装(转载收藏)
2010-10-14 13:02 2104[简介] 这两天用python写一个程序,需要对各种格式的 ... -
python:在python中使用opencv进行摄像头编程初体验
2009-12-02 13:11 3960闲着没事做,前段时间买了个摄像头,在ubuntu上用。打开ch ... -
python使用tuple作参数
2009-08-07 15:53 3625def a(*aa): print aa[0] ... -
python sort key
2009-08-07 13:18 2466>>> a=range(10) >&g ... -
python 自带小爬虫
2009-08-07 10:28 1959#! /usr/bin/env python “”" ... -
Python支持中文
2009-08-07 10:27 3230让Python支持中文要在Python代码头部加上# -* ... -
Python多线程 简明例子
2009-08-07 10:27 3049综述 多线程是 ... -
Python多线程编程
2009-08-07 10:26 4067我们在做软件开发的时 ... -
python循环采集
2009-08-07 10:26 1606html=”<td>1</td>< ... -
python的字符操作函数
2009-08-07 10:25 2112在python有各种各样的stri ... -
python去除html标签
2009-08-07 10:24 3518from HTMLParser import HTMLPars ... -
python 下载文件
2009-08-06 14:12 4858抓取数据的时候,有的时候是需要下载一些文件的,比如图片,pdf ... -
python 去除空格,回车符,换行符
2009-08-06 14:05 10673s=’ as asdas \r\nasda’print ” ... -
Python版Linux 下的迅雷
2009-07-29 11:56 2876Linux 下该不该有迅雷,这个问题一直存在分歧,在此也不予讨 ... -
linux下python默认版本的选择
2009-07-29 10:50 2599当你在linux系统下安装了不同版本的python, 怎样设定 ... -
Python监视进程
2009-06-23 11:03 2498由subprocess创建一个进程,然后进行监视 每一秒钟查看 ... -
python pyc pyo
2009-06-19 13:56 4778python并非完全是解释性语言,它是有编译的,先把源码py文 ... -
python chr()、unichr()和ord()
2009-06-18 17:15 64218chr()、unichr()和ord() chr()函数用一 ... -
python打印所有汉字...
2009-06-18 17:04 2698for ch in xrange(0x4e00, 0x9fa6 ... -
程序签名
2009-06-18 16:43 1125打开https://www.symbiansigned.com ...
相关推荐
在S60平台上,Python提供了一个轻量级的解释器,使得开发人员能够快速地创建和部署应用,而无需深入学习复杂的原生Symbian C++开发。 Python S60的关键知识点包括: 1. **环境设置**:安装Python for S60的SDK,...
Python S60 文件管理器源程序是一个专门为S60平台设计的文件操作工具,它使用Python编程语言实现。S60(Series 60)是诺基亚开发的一种基于Symbian操作系统上的用户界面,广泛应用于早期的智能手机。Python S60 文件...
### S60平台Bluetooth API开发伙伴指南——蓝牙的结构概述 #### 一、蓝牙的堆栈结构 蓝牙技术作为一种无线通信技术,其架构类似于其他通信技术,由一系列组件构成,形成了一个堆栈结构。在S60平台上,蓝牙应用程序...
- **PyS60**:一个允许开发者使用Python语言为S60平台编写应用程序的环境。PyS60提供了许多用于访问S60 API的模块。 - **appuifw模块**:PyS60中的一个核心模块,用于简化用户界面的开发。自PyS60 1.9.3版本起,...
s60第三版——来电柳丁Newding v4.03 版
- `install.jar`:可能是Java应用程序的安装包,可能用于在S60设备上安装一个示例应用或开发工具。 - `UNIX_Setup.sh`:这是一个Unix/Linux系统下的脚本文件,用于在这些平台上设置或安装相关环境。 - `MacOS_Setup`...
【S60平台Bluetooth API开发伙伴指南——蓝牙开发接口V2的结构】 S60平台的蓝牙API开发接口V2在Symbian v8.0a(S60第二版,Feature Pack2)中得到了显著增强,这为开发者提供了更高效和安全的蓝牙应用开发环境。...
S60(Series 60)是诺基亚开发的一种智能手机操作系统,而Python作为一种简洁易学的编程语言,被引入到S60系统中,使得开发者能够利用Python快速构建移动应用程序。 本教程的目标是帮助初学者掌握如何在S60手机上...
Python for S60 是一个专门为诺基亚S60平台设计的Python环境。它允许开发者利用Python编写应用程序,并在S60智能手机上运行。该文档介绍了如何安装Python运行时及其依赖项,以及如何打包示例应用。同时,文档详细地...
总之,Python for S60 提供了一个高效且灵活的平台,允许开发者使用Python语言开发S60设备的应用。通过深入学习API文档,结合实际的博客案例,开发者能够充分利用S60设备的潜力,创造出多样化的移动应用。无论是简单...
《Symbian OS 软件开发——应用C++开发智能手机应用程序入门》是针对Symbian操作系统进行软件开发的一本专业教程,旨在帮助开发者利用C++语言构建智能手机应用程序。Symbian OS曾是全球最广泛使用的智能手机操作系统...
【Python for S60】是Symbian操作系统中用于在S60平台上开发Python应用程序的工具,它使得在手机上编写和运行Python脚本成为可能。Python作为一种强大的脚本语言,以其简洁易读的语法和无需编译即可执行的特性受到...
Python编程之PyS60是针对S60平台的Python应用开发课程,旨在教会开发者如何利用Python语言在诺基亚S60智能手机上构建应用程序。PyS60是由Python for S60(简称Pys60)项目提供的,它是一个移植版的Python解释器,...
12. **S60V3平台**:这个标签暗示了教程可能涵盖如何在诺基亚S60第三版手机上安装和运行Python环境,以及可能的移动应用开发基础。 教程“[教程] S60V3【Python编程学院】py编程其实很简单!”可能包含逐步的教学...
多媒体应用:Python的PyOpenGL模块封装了“OpenGL应用程序编程接口”,能进行二维和三维图像处理。PyGame模块可用于编写游戏软件。 pymo引擎:PYMO全称为python memories off,是一款运行于Symbian S60V3,Symbian3,...
4. **移动应用开发实践**:通过实例教程,展示如何从零开始创建一个S60平台上的Python应用,包括UI设计、事件处理、数据存储等方面。 5. **调试与优化**:讲解如何在S60设备上进行代码调试,以及针对移动设备性能的...
多媒体应用:Python的PyOpenGL模块封装了“OpenGL应用程序编程接口”,能进行二维和三维图像处理。PyGame模块可用于编写游戏软件。 pymo引擎:PYMO全称为python memories off,是一款运行于Symbian S60V3,Symbian3,...
总的来说,Python是一个强大且易学的编程语言,特别适合初学者入门。通过了解其基础知识,安装必要的开发环境,以及不断地实践和探索,任何人都能逐步精通Python编程。无论是手机端还是桌面端,Python都能提供丰富的...
Python for S60是一种在诺基亚S60平台上进行编程的语言,它允许开发者使用Python语法来创建应用程序。本教程由阿斌提供,旨在帮助初学者入门Python for S60编程。 ### 1. 编写Python脚本 在Python for S60中,编写...
PYS60,全称为Python for Series 60,是一个专为诺基亚S60平台设计的Python解释器,允许用户在S60智能手机上运行Python脚本,极大地扩展了设备的应用潜力。本次分享的是PYS60的1.4.5版本源代码,这个版本在社区中...