I am new to python and to wxWindows. I have tried searching google, reading the documentation and trying to figure out some of the examples, but I am stumped as to how to get information out of a listctrl at a certain row and column. I tried to write a simple example to learn to work with the listctrl as follows: -------------------------------------- #!/usr/bin/env python # -*- coding: ISO-8859-1 -*- # generated by wxGlade 0.4 on Wed Nov 16 10:23:06 2005
import wx 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.panel_1 = wx.Panel(self, -1) self.list_ctrl_1 = wx.ListCtrl(self.panel_1, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.label_1 = wx.StaticText(self.panel_1, -1, "label_1") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelected, self.list_ctrl_1) # end wxGlade self.list_ctrl_1.InsertColumn(0,"Name") self.list_ctrl_1.InsertColumn(1,"Address") self.list_ctrl_1.SetColumnWidth(0, 215) self.list_ctrl_1.SetColumnWidth(1, 55) self.list_ctrl_1.InsertStringItem(0,"John Smith") self.list_ctrl_1.SetStringItem(0,1, "123 Elm") self.list_ctrl_1.InsertStringItem(1,"Tom Clark") self.list_ctrl_1.SetStringItem(1,1, "415 W. 1st") def __set_properties(self): # begin wxGlade: MyFrame.__set_properties self.SetTitle("frame_1") # end wxGlade def __do_layout(self): # begin wxGlade: MyFrame.__do_layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) sizer_2.Add(self.list_ctrl_1, 1, wx.EXPAND, 0) sizer_2.Add(self.label_1, 0, wx.ADJUST_MINSIZE, 0) self.panel_1.SetAutoLayout(True) self.panel_1.SetSizer(sizer_2) sizer_2.Fit(self.panel_1) sizer_2.SetSizeHints(self.panel_1) sizer_1.Add(self.panel_1, 1, wx.EXPAND, 0) self.SetAutoLayout(True) self.SetSizer(sizer_1) sizer_1.Fit(self) sizer_1.SetSizeHints(self) self.Layout() # end wxGlade def OnSelected(self, event): # wxGlade: MyFrame.<event_handler> self.currentItem = event.m_itemIndex #What do I put here to get the contents of the Address column? #I want to do something like self.label_1.SetLabel(?) #where the ? is the contents of the address column of the selected row event.Skip() # end of class MyFrame class MyApp(wx.App): def OnInit(self): wx.InitAllImageHandlers() frame_1 = MyFrame(None, -1, "") self.SetTopWindow(frame_1) frame_1.Show() return 1 # end of class MyApp if __name__ == "__main__": app = MyApp(0) app.MainLoop() ------------------------------------------------------- But I can't figure out how to get the contents of the second column on the selected row. Any help is appreciated. -- http://mail.python.org/mailman/listinfo/python-list