P
Piet
Hi there.
I am trying to display tabular data in a wxListCtrl. What I get from
the script below are only the headers, not the items themselves. The
documentation didn´t help me much; instead I was lost in ListItemId´s
and different possibilities of inserting items and strings. I am sure
the solution is only one step away, but I need somebody to point in
the direction. Heres the script:
from wxPython.wx import *
class MainWindow(wxFrame):
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,-1, title,
style=wxDEFAULT_FRAME_STYLE)
self.panel = wxPanel(self,-1)
self.Lctrl = wxListCtrl(self.panel,-1,size=(200,200),style =
wxLC_REPORT)
for i in range(2):
self.Lctrl.InsertColumn(i,"Column"+str(i),format=wxLIST_FORMAT_LEFT,width=100)
self.Lctrl.SetStringItem(i,1,"Hi")
self.Lctrl.SetStringItem(i,2,"there")
self.Lctrl.SetItemData(i,1)
app = wxPySimpleApp()
frame = MainWindow(None, -1, "List Control Test")
frame.Show(1)
app.MainLoop()
Best regards
Peter
I am trying to display tabular data in a wxListCtrl. What I get from
the script below are only the headers, not the items themselves. The
documentation didn´t help me much; instead I was lost in ListItemId´s
and different possibilities of inserting items and strings. I am sure
the solution is only one step away, but I need somebody to point in
the direction. Heres the script:
from wxPython.wx import *
class MainWindow(wxFrame):
def __init__(self,parent,id,title):
wxFrame.__init__(self,parent,-1, title,
style=wxDEFAULT_FRAME_STYLE)
self.panel = wxPanel(self,-1)
self.Lctrl = wxListCtrl(self.panel,-1,size=(200,200),style =
wxLC_REPORT)
for i in range(2):
self.Lctrl.InsertColumn(i,"Column"+str(i),format=wxLIST_FORMAT_LEFT,width=100)
self.Lctrl.SetStringItem(i,1,"Hi")
self.Lctrl.SetStringItem(i,2,"there")
self.Lctrl.SetItemData(i,1)
app = wxPySimpleApp()
frame = MainWindow(None, -1, "List Control Test")
frame.Show(1)
app.MainLoop()
Best regards
Peter