I have wx.ListCtrl and I want to insert images (icons) to each item.
This is my code:
class ListView(wx.Panel):
def __init__(self,parent,size):
wx.Panel.__init__(self,parent,-1,size=size)
GameList = wx.ListCtrl(self,-1,pos=(20,20),size=(200,200))
il = wx.ImageList(16,16)
img_list=GameList.SetImageList(il, wx.IMAGE_LIST_SMALL)
images=["joystick.png"]
il.Add(wx.Bitmap(images[0]))
index=GameList.InsertImageItem(0,0)
Somehow, it doesn't work. Thanks in advance
You are missing:
self.list.SetImageList(il, wx.IMAGE_LIST_SMALL)
In cases like this it is always a good idea to look at the wxPython demo:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.