Skip to content

Instantly share code, notes, and snippets.

@jrosco
Created March 13, 2014 11:23
Show Gist options
  • Save jrosco/1aaf207e05446f0fd8fe to your computer and use it in GitHub Desktop.
Save jrosco/1aaf207e05446f0fd8fe to your computer and use it in GitHub Desktop.
import wx
import glob
""" Example at http://zetcode.com/wxpython/skeletons/ """
class DemoFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "wx.ListCtrl in wx.LC_REPORT mode", size=(600, 400))
self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_AUTOARRANGE)
green_image = '../images/green-circle.png'
red_image = '../images/red-circle.png'
self.il = wx.ImageList(15, 15)
green = self.il.Add(wx.Image(green_image, wx.BITMAP_TYPE_PNG).ConvertToBitmap())
red = self.il.Add(wx.Image(red_image, wx.BITMAP_TYPE_PNG).ConvertToBitmap())
self.list.AssignImageList(self.il, wx.IMAGE_LIST_SMALL)
self.list.InsertColumn(0, 'text', width=100)
self.list.InsertColumn(1, 'img', width=100)
self.list.InsertStringItem(0, 'OK')
self.list.SetItemImage(0, green)
self.list.InsertStringItem(1, 'FAIL')
self.list.SetItemImage(1, red)
app = wx.PySimpleApp()
frame = DemoFrame()
frame.Show()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment