Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:How to change screen size in PySymbian

From Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90, Nokia N82, Nokia 5800 XpressMusic
Platform(s): S60 1st Edition, S60 2nd Edition, S60 3rd Edition, S60 5th Edition
Keywords: appuifw
Created: cyke64 (15 Mar 2007)
Last edited: hamishwillee (31 May 2013)



This article shows how to change an application's screen size in PySymbian (Python). The sample code supports any screen size and screen rotation during application runtime.


An application's body uses a normal screen area by default. The currently used area can be retrieved and set by using the screen attribute of the application instance.

The possible screen modes are:

  • 'normal' - title pane and softkeys area are visible (default)
  • 'large' - only softkeys area is visible
  • 'full' - the application's body takes up the entire screen; on S60 5th Edition it has the same effect as 'large', meaning the softkeys area is still visible
  • 'full_max' - introduced in PySymbian 1.9.4; on S60 3rd Edition it has the same effect as 'full' and on S60 5th Edition the application's body takes up the entire screen including the softkeys area

Source code

import e32, appuifw, graphics
#Global variables to control application execution
app_lock = e32.Ao_lock()
my_timer = e32.Ao_timer()
#Global variables for application UI
canvas = None
img = None
def cb_quit():
'''Callback for exit, do clean-up'''
def cb_handle_redraw(dummy = (0, 0, 0, 0)):
'''Overwrite default screen redraw event handler'''
#This might be called automatically before img is created
if img:
def cb_handle_resize(dummy=(0, 0, 0, 0)):
'''Overwrite default screen resize event handler'''
global img
#This might be called automatically before canvas is created
if canvas:
#Create a coloured full-screen image
img =
#Initialize application UI = 'full'
canvas = appuifw.Canvas(resize_callback = cb_handle_resize,
redraw_callback = cb_handle_redraw) = canvas = cb_quit
#Initialize application
#Show the 3 possible layouts with a 3 second pause between them
# full_max only in PySymbian 1.9.4, removed after that = 'full_max'
except: = 'full'
my_timer.after(3) = 'large'
my_timer.after(3) = 'normal'
#Wait for the user to request the exit


The three possible layouts are examplified.

Full screen
Large screen
Normal screen
This page was last modified on 31 May 2013, at 01:03.
71 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.