wxPython ListCtrl image configuring
kyosohma at gmail.com
kyosohma at gmail.com
Thu Nov 8 09:18:59 EST 2007
On Nov 8, 5:45 am, vedrandeko... at v-programs.com wrote:
> Hello,
>
> Here is example of my ListCtrl items with image:
>
> ( filebox1 is ListCtrl )
>
> il = wx.ImageList(16,16)
> images=["file1.png","folder.png"]
> for i in images:
> il.Add(wx.Bitmap(i))
> img_list=filebox1.SetImageList(il, wx.IMAGE_LIST_SMALL)
> j=1
> unos1p=unos1.GetValue()
> unos2p=unos2.GetValue()
> unos3p=unos3.GetValue()
> newftp=FTPHost(unos1p,unos2p,unos3p)
> for item in newftp._dir('/'):
> if item.split()[2]=="<DIR>":
> index=filebox1.InsertStringItem(j,item)
> filebox1.SetItemImage(index,2)
>
> else:
> index=filebox1.InsertStringItem(j,item)
> filebox1.SetItemImage(index,1)
>
> ......Then my program show all items and images with them, but the
> problem is when I click on item
> image of item disappere .Any idea?
>
> Regards,
> Vedran
I'm not seeing anything, but then again I don't use images in my
listctrls. I would recommend posting your on-click event handler. You
may find the wxPython demo's code helpful. You can also see more
examples on the wxPython wiki:
http://wiki.wxpython.org/ListControls
http://wiki.wxpython.org/Refillable_List_Control
You should also post to the wxPython user's group: http://www.wxpython.org/maillist.php
Mike
More information about the Python-list
mailing list