listctrl question

Nathan McBride wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey guys I'm just starting out with wxPython and was just wandering how
to add one of the stock wx.___ icons to the first column of my 3 column
ctrl?

wx.ListCtrl doesn't support stock icons the same way that buttons and menus do (on wxGTK.) You'll need to get the images from somewhere, add them to a wx.ImageList, and then use that image list with the wx.ListCtrl as shown in the demo. There is a limited set of images provided with wxWidets via the wx.ArtProvider class. You can see that used in the demo too.

···

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

Ok, I'm a little confused now. :smiley:
I think I am doing it correctly like your advising but the icon doesn't
appear.
Here is what I have so far:

        self.container_list = wx.ListCtrl(self, -1, size = (600,100),
style = wx.LC_REPORT)
        self.container_list.InsertColumn(0, "Status", width = 80)
        self.container_list.InsertColumn(1, "Container", width = 150)
        self.container_list.InsertColumn(2, "Mount", width = 370)
       
        ap = wx.ArtProvider()
       
        self.image_list = wx.ImageList(16,16)
        self.image1 = self.image_list.Add(ap.GetBitmap(wx.ART_QUESTION,
wx.ART_FRAME_ICON, (16,16)))
       
        list_count = self.container_list.GetItemCount()
        self.container_list.InsertImageItem(list_count, self.image1)
        self.container_list.SetStringItem(list_count, 1, "test")

Robin Dunn wrote:

Nathan McBride wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey guys I'm just starting out with wxPython and was just wandering how
to add one of the stock wx.___ icons to the first column of my 3 column
ctrl?

wx.ListCtrl doesn't support stock icons the same way that buttons and

menus do (on wxGTK.) You'll need to get the images from somewhere, add
them to a wx.ImageList, and then use that image list with the
wx.ListCtrl as shown in the demo. There is a limited set of images
provided with wxWidets via the wx.ArtProvider class. You can see that
used in the demo too.

···