Change the image of a list item (listctrl)
Donn Ingle
donn.ingle at gmail.com
Sat Dec 2 09:14:29 PST 2006
Hello, me again.
I am going blue in the face trying to change the icon of an item in a list
control.
I have an Image list with two icons in it. It's assigned correctly.
The icons are all set in a loop like so:
for p in pl :
ipog = Pog ( p )
try: #catch pogs that are not properly formed
if ipog.isInstalled ( ): i = 1
else: i = 0
li = wx.ListItem ( )
li.SetImage ( i )
li.SetText ( p )
self.InsertItem ( li )
Nevermind the fluff, the SetImage ( ) part works fine.
So, later, when I select an item and click a button, I want that item's icon
to change.
I am here at the moment, no change actually happens:
ii = self.GetFocusedItem ( )
i = self.GetItem ( ii )
print "PRE:", i.GetImage ( )
i.SetImage ( 1 )
print "POST:", i.GetImage ( )
Any help ?
/d
More information about the wxpython-users
mailing list