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 use icon in listbox 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): Nokia N96
Platform(s): S60 2nd Edition, S60 3rd Edition
Keywords: appuifw
Created: cyke64 (15 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Python provide some graphics capabilities. One of them is using icons in Listbox.

  • with Python 2nd Edition
icon1 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm", 28, 29)
icon2 = appuifw.Icon(u"z:\\system\\data\\avkon.mbm ", 40, 41)
entries = [(u"Signal", icon1),
(u"Battery", icon2)
lb = appuifw.Listbox(entries, lbox_observe)
  • Python 3rd Edition : avkon2.mbm is used instead of avkon.mbm
icon1 = appuifw.Icon(u"z:\\system\\data\\avkon2.mbm", 28, 29)
icon2 = appuifw.Icon(u"z:\\system\\data\\avkon2.mbm ", 40, 41)
entries = [(u"Signal", icon1),
(u"Battery", icon2)
lb = appuifw.Listbox(entries, lbox_observe)

Listbox is one of the 3 types that can be assigned to app.body other types are Text and Canvas. So, to make code above able to run, you must add = lb

and the function lbox_observe that will handle the selection need to be defined.

Note that you can use also scalable icons in PySymbian if you are running on S60 2.8 or above (run the following under script shell or add proper code for exiting if running standalone):

import appuifw
import e32
# Indeces from Symbian\9.1\S60_3rd_MR\Epoc32\include\avkon.mbg file
EMbmAvkonQgn_prop_signal_icon = 16412
EMbmAvkonQgn_prop_signal_icon_mask = 16413
EMbmAvkonQgn_prop_battery_icon = 16424
EMbmAvkonQgn_prop_battery_icon_mask = 16425
ICON_FILE = u"z:\\resource\\apps\\avkon2.mif"
def clean():
icon1 = appuifw.Icon(ICON_FILE,
icon2 = appuifw.Icon(ICON_FILE,
entries = [(u"Signal", u"Strong", icon1),
(u"Battery", u"Full", icon2)
lb = appuifw.Listbox(entries) = lb


Listbox with icons

Related Links

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