Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
This page was last modified 12:03, 12 November 2007.

How to use icon in listbox

From Forum Nokia Wiki

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

appuifw.app.body = lb

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

Note that you can use also scalable icons in PyS60 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():
    lock.signal()
 
icon1 = appuifw.Icon(ICON_FILE,
                     EMbmAvkonQgn_prop_signal_icon,
                     EMbmAvkonQgn_prop_signal_icon_mask)
icon2 = appuifw.Icon(ICON_FILE,
                     EMbmAvkonQgn_prop_battery_icon,
                     EMbmAvkonQgn_prop_battery_icon_mask)
 
entries = [(u"Signal", icon1),
           (u"Battery", icon2)
          ]
lb = appuifw.Listbox(entries)
 
appuifw.app.body = lb
 
lock=e32.Ao_lock()
appuifw.app.exit_key_handler=clean
lock.wait()
Related Discussions
Thread Thread Starter Forum Replies Last Post
Listbox with icons --> KERN-EXEC 3 TPMaKom General Symbian C++ 1 2005-12-15 14:43
problem in ListBox aditighosal General Symbian C++ 8 2008-07-16 20:01
Changing the content of a listbox dinamically ngabordh Symbian User Interface 3 2004-03-30 04:11
Folders in listbox jrantam Symbian User Interface 2 2008-10-10 11:44
no midlet-icon shown sommeralex Mobile Java General 3 2007-02-16 12:18
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZpythonQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX