ImageList and ListCtrl

So, thanks to Robin, I am making progress. imagelist_icon.py is a
working example, the only problem is that the ListCtrl wraps and seems
to want to scroll horizontally. It would really fit my application
better if it scrolled vertically and was essentially a one column
format. As I understand it, I need to set up my ListCtrl to be in
report mode. imagelist_report.py represents my attempt to do that,
but the thumbnails all end up on top of one another. Here is the
__init__ method:

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.list = wx.ListCtrl(self, -1,
style=wx.LC_ICON|wx.LC_NO_HEADER|wx.SUNKEN_BORDER)

        il = wx.ImageList(267, 200)
        myfiles = glob.glob('IMG*.JPG')
        for n, curfile in enumerate(myfiles):
            img = wx.Image(curfile)
            il.Add(wx.BitmapFromImage(img))
            self.list.InsertImageItem(n, n)

        self.list.AssignImageList(il, wx.IMAGE_LIST_NORMAL)

        self.__set_properties()
        self.__do_layout()

What am I doing wrong?

Thanks,

Ryan

imagelist_icon.py (1.41 KB)

imagelist_report.py (1.77 KB)

ยทยทยท

On Feb 8, 2008 4:12 PM, Robin Dunn <robin@alldunn.com> wrote:

Ryan Krauss wrote:
> I am trying to build on some code submitted to the list a while back.
> I want to display some thumbnails in a ListCtrl using an ImageList. I
> can't figure out why the attached code doesn't actually work. I don't
> get any error messages, but no images are displayed (I just get a
> white canvas).

You never add any items to your list ctrl.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org