I have the following code to add 6 buttons to BoxSizer
for word in words: btn = wx.Button(self, label=word) btn.Bind(wx.EVT_BUTTON, self.onWordSelect)
In my onWordSelect method onWordSelect I try to remove all the buttons that I created in Sizer so that I can create new buttons. My problem is that all buttons are deleted, except the last one.
Here is my code for removing buttons:
for child in self.sizer.GetChildren(): self.sizer.Remove(child.Window) self.sizer.Layout()
When checking len(self.sizer.GetChildren()) it returns 0 , but the last button is still displayed on the screen.
source share