
import wx

class MyFrame(wx.Frame):

    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 400))

        # Now create the Panel to put the other controls on.
        panel = wx.Panel(self)

        btnBold = wx.Button(panel, -1, "Bold")
        btnRed = wx.Button(panel, -1, "Red")
        self.Bind(wx.EVT_BUTTON, self.OnBold, btnBold)
        self.Bind(wx.EVT_BUTTON, self.OnRed, btnRed)

        # create alist control
        self.listControl = wx.ListCtrl(panel, style=wx.LC_REPORT, size=(200,100))
        self.listControl.InsertColumn(0, "Col1")
        self.listControl.InsertColumn(1, "Col2")
        self.listControl.InsertStringItem(0, "Data 1")
        self.listControl.SetStringItem(0,1, "Data 2")

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.listControl, 0, wx.ALL, 10)
        sizer.Add(btnBold, 0, wx.ALL, 10)
        sizer.Add(btnRed, 0, wx.ALL, 10)
        panel.SetSizer(sizer)
        panel.Layout()

    def OnBold(self, evt):
        f = self.listControl.GetItemFont(0)
        f.SetWeight(wx.BOLD)
        self.listControl.SetItemFont(0, f)
    
    def OnRed(self, evt):
        self.listControl.SetItemTextColour(0, wx.RED)

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, "Demonstrate listctrl")
        self.SetTopWindow(frame)
        frame.Show(True)
        return True
        
app = MyApp(redirect=True)
app.MainLoop()