Following this tutorial on WxPython, I've noticed that in the Find/Replace Dialog example there are extra panels where it doesn't seem like they're actually doing anything. In fact, they seem to mess up even more the layout (though that is probably some mistake I made somewhere) For example, the tutorial has this code:
panel = wx.Panel(self, -1)
panel1 = wx.Panel(panel, -1)
grid1 = wx.GridSizer(2, 2)
grid1.Add(wx.StaticText(panel1, -1, 'Find: ', (5, 5)), 0, wx.ALIGN_CENTER_VERTICAL)
grid1.Add(wx.ComboBox(panel1, -1, size=(120, -1)))
grid1.Add(wx.StaticText(panel1, -1, 'Replace with: ', (5, 5)), 0, wx.ALIGN_CENTER_VERTICAL)
grid1.Add(wx.ComboBox(panel1, -1, size=(120, -1)))
panel1.SetSizer(grid1)
vbox.Add(panel1, 0, wx.BOTTOM | wx.TOP, 9)
Why is that different from:
panel = wx.Panel(self, -1)
grid1 = wx.GridSizer(2, 2)
grid1.Add(wx.StaticText(panel, -1, 'Find: ', (5, 5)), 0, wx.ALIGN_CENTER_VERTICAL)
grid1.Add(wx.ComboBox(panel, -1, size=(120, -1)))
grid1.Add(wx.StaticText(panel, -1, 'Replace with: ', (5, 5)), 0, wx.ALIGN_CENTER_VERTICAL)
grid1.Add(wx.ComboBox(panel, -1, size=(120, -1)))
vbox.Add(grid1, 0, wx.BOTTOM | wx.TOP, 9)
Note that I'm not creating a panel, just adding grid1
directly to vbox
.