Hello,
I am trying to change the text of a column header in a ListCtrl widget
without success. The following code tries to rewrite the header every
2 seconds. The SetText seems to be successful because the string just
written can be read with GetText, but the string displayed by the
header never changes. What I am missing? Thank you in advance for any
help.
#!/usr/bin/python
import wx
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None,-1,"TEST")
id=wx.NewId()
self.list=wx.ListCtrl(frame,id,style=wx.LC_REPORT)
self.list.InsertColumn(0,"HEADER 0")
self.list.InsertStringItem(0,"ITEM 0")
frame.Show(True)
# start a wx timer calling back toggle header every 2 seconds."
self.timer1 = wx.Timer(frame,wx.NewId())
frame.Bind(wx.EVT_TIMER,self.toggle_header,self.timer1)
self.timer1.Start(2000,oneShot=False)
return True
I've add
self.list.SetColumn(0, column)
and
self.list.RefreshItem(0)
On my Debian Lenny it works.
ciao
Beppe
···
On Dec 3, 3:42 pm, Fabrizio Pollastri <area...@gmail.com> wrote:
Hello,
I am trying to change the text of a column header in a ListCtrl widget
without success. The following code tries to rewrite the header every
2 seconds. The SetText seems to be successful because the string just
written can be read with GetText, but the string displayed by the
header never changes. What I am missing? Thank you in advance for any
help.
#!/usr/bin/python
import wx
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None,-1,"TEST")
id=wx.NewId()
self.list=wx.ListCtrl(frame,id,style=wx.LC_REPORT)
self.list.InsertColumn(0,"HEADER 0")
self.list.InsertStringItem(0,"ITEM 0")
frame.Show(True)
# start a wx timer calling back toggle header every 2 seconds."
self.timer1 = wx.Timer(frame,wx.NewId())
frame.Bind(wx.EVT_TIMER,self.toggle_header,self.timer1)
self.timer1.Start(2000,oneShot=False)
return True