0
我有wx.ListCtrl,我想插入圖像(圖標)到每個項目。wx.ListCtrl與圖像(wxPython)
這是我的代碼:
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)
不知何故,這是行不通的。在此先感謝
您是否收到任何錯誤消息?如果是這樣,請發佈那些與您的問題 – wnnmaw 2015-02-09 18:25:52
好,我沒有得到錯誤信息,它只是不會顯示圖像。 @wnnmaw – 2015-02-09 18:41:47
圖像大小合適嗎?另外,我不確定列表控件是否可以處理PNG。你用JPEG試過了嗎? – 2015-02-09 20:32:10