Hello,
I am developing my first gui with wxPython and I have been facing a problem for some time now. I have a GridBagSizer and at some point during the program I change the content of one the positions in it. However, the old content is not removed from the screen. Furthermore, the new item doesn’t even get on the same position as the old one.
There’s a little example below.
Any help is appreciated. Thanks,
Martin
···
import wx
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent)
mainSizer = wx.BoxSizer(wx.HORIZONTAL)
grid = wx.GridBagSizer(hgap=2, vgap=2)
text1 = wx.StaticText(self, label='Text 1')
grid.Add(text1, pos=(0,0))
text2 = wx.StaticText(self, label='Text 2')
grid.Add(text2, pos=(0,0))
mainSizer.Add(grid, 0, wx.ALL, 5)
self.SetSizerAndFit(mainSizer)
self.Show()
app = wx.App(False)
frame = MyFrame(None)
app.MainLoop()