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. Thanks for all your past and future contributions.

Archived:How to draw directly to the phone screen using 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): S60 3rd Edition FP1 SDK
Platform(s): S60 2nd Edition, S60 3rd Edition
Keywords: fgimage
Created: cyke64 (19 Mar 2007)
Last edited: hamishwillee (31 May 2013)


You can draw directly to the phone screen. It is useful for a notification from a background program. You need to install fgimage module :

Code Snippets

The following code snippet draws hello world and clears it after 1 second.

import fgimage, e32
from graphics import Image
img =, 16)) # create a notification text
img.text((0, 14), u'Hello world', 0)
fg = fgimage.FGImage()
x, y = 0, 40 # position to draw
fg.set(x, y, img._bitmapapi()) # send it
fg.unset() # then clear it
import e32
from graphics import *
import fgimage
img =, 16))
fg = fgimage.FGImage()
text = u"This is where the text goes"
# Does simple scrolling
i = 0
while i < len(text):
img.clear((0, 255, 255))
img.text((0, 14), text[i:], 0)
fg.set(0, 40, img._bitmapapi())
e32.ao_sleep(0.2) # 200 ms sleep
i += 1

The following code snippet draws on the phone screen, fetches the pixel value and draws the same pixel somewhere else.

import e32
from graphics import *
import fgimage
image =, 208))
image.point((10,10), 0x00ff00, width=10) # green
value = fgimage.getpixel(10, 10, img._bitmapapi())
img.point((20,20), value, width=1)
print hex(value)
def drawit():
canvas.blit(image) = canvas = appuifw.Canvas()

See Also

This page was last modified on 31 May 2013, at 01:08.
46 page views in the last 30 days.