Info: How to build an application? -> 9 steps that can be helpful
9 steps that can be helpful to build an application:
1. import all modules needed
2. set the screen size (normal, large, full)
3. create your application logic ...
4. create an application menu (if neccessary)
5. set an exit key handler
6. set the application title
7. deal with active objects if neccessary
8. set the application body (text or canvas or listbox or none)
9. create a main loop (e.g. while loop) if suitable
1. How to import all modules needed
2. How to set the screen size?
# screen has 3 different values:
3. How to create your application logic ?
Well this whole tutorial is about that ... You certainly need some app logic to get your app running, whatever logic it may be!
4. How to create an application menu ?
An application menu uses the left softkey and can always be accessed while your application is running. An application menu can contain also a submenu
# create the callback functions that shall be executed when when selecting an item in
# 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),
5. How to set an exit key handler ?
6. How set the application title?
appuifw.app.title = u"SMS sending"
7. How to deal with active objects if neccessary?
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
# create an instance of the active object
# starts a scheduler -> the script processes events (e.g. from the UI) until lock.signal() is
# stops the scheduler
-> For more detail see the API_Reference_for_Python.pdf.
8. How to set the application body ? (text or canvas or listbox or none)
# body as Listbox:
# body as Text:
# body as Canvas:
9. How to create a main loop ?
# put in the main loop the things that need to be run through again and again in your script
running = 1
Here are 2 examples of application skeletons that I ususally use:
1. no main loop because the application logic works without
Example script: app_skeleton.py
2. with mainloop (if suitable)
Example script: app_skeleton_with_mainloop.py