wxPython ListCtrl image configuring

V

vedrandekovic

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
 
K

kyosohma

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,139
Messages
2,570,807
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top