> So I am trying to use a wxListCtrl... and I am wondering:
> what is the label in InsertStringItem(index, label) used for ?
The text that will be displayed in the first column (col index 0)
If you have more than one column, you will set other columns text with
SetStringItem(index, col, label, imageId)
This is my test file:
from wxPython.wx import *
class MainFrame(wxFrame):
def __init__(self,parent,ID,title):
wxFrame.__init__(self,parent,ID,title)
self.__listbox = wxListCtrl(self, -1, style=wxLC_REPORT)
self.__listbox.InsertColumn(0, 'Subject')
self.__listbox.InsertColumn(1, 'Name')
for i in range(10):
self.__listbox.InsertStringItem(i, 'what is this label for ? ');
self.__listbox.SetStringItem(i, 0, str(i))
self.__listbox.SetStringItem(i, 1, "hop")
self.__listbox.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER)
self.__listbox.SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER)
class MyApp(wxApp):
def OnInit(self):
frame = MainFrame(NULL,-1,'Test')
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
What I get is two columns, one labeled 'Subject', the other 'Name',
but this 'what is this label for ? ' doesnot appear anywhere on the list
control.
Well, it works fine for me this way, I can do what I want, I am just
curious.
How should I write this bit of code if I wanted to use this label in
InsertStringItem
somewhere ?
Stephane