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

import appuifw
import e32


2. How to set the screen size?

# screen has 3 different values:'normal' #(a normal screen with title pane and softkeys)'large' #(only softkeys visible)'full' #(a full screen)

Example script:


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
# the menu:

def item1():
    print "item one"

def subitem1():
    print "subitem one"

def subitem2():
    print "subitem two"

# create the menu using[(title, callback1), (title, (subtitle, callback2))] = [(u"item 1", item1), (u"Submenu 1", ((u"sub item 1", subitem1),
                                  (u"sub item 2", subitem2)))]

Example script:

5. How to set an exit key handler ?

The exitkey handler gets activated when you press the right (exit) softkey. By assigning an extra function to the .exit_key_handler you can define what shall happen when it is pressed.

def quit():



6. How set the application 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
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.

# 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: = appuifw.Listbox(entries,shout)

# Example script:

# body as Text: = appuifw.Text(u'hello')

# Example script:

# body as Canvas:, redraw_callback=handle_redraw)

# Example script:


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

while running:
    # #e.g. redraw the screen:


Here are 2 examples of application skeletons that I ususally use:

1. no main loop because the application logic works without

Example script:


2. with mainloop (if suitable)

Example script:








Previous|Next | Menu         Copyright (c) 2006 Jurgen Scheible