I have both textctrl and listctrl in my Parent frame. I want to erase both the teletext and listctrl in one click. so when the reset button is clicked it should erase all text and list.How do i accomplish this? I am trying this but that gives me error
self.reset_btn=wx.Button(p,-1,"Reset!")
self.reset_btn.Bind(wx.EVT_BUTTON, self.OnReset, self.reset_btn)
bs.Add(self.reset_btn,0,wx.ALIGN_CENTER)
def OnReset(self, event):
self.list.ClearAll()
self.text.ClearAll()
You are correct, instead it has Clear
instead.
self.text.Clear()
In anticipation of your next question, which might well be, when I have run ClearAll
on my ListCtrl
, why do I get invalid item column
, when trying to repopulate the data in the listctrl?
Because ClearAll
will have done just what it said on the tin, it cleared everything. So you will have to redo the InsertColumn()
commands, that you initially did.
So, instead of using self.list.ClearAll()
use self.list.DeleteAllItems()
which only clears the data.