Instantiate GridSizer() in a way that works on both Wx 3. and 4.

Looks like GridSizer.SetHGap() and SetVGap() have no effect on Wx 3.
But at least now it doesn't crash on Wx 3.
This commit is contained in:
James Bowman 2019-09-10 11:42:30 -07:00
parent 53131672e0
commit 8a4007b75c
1 changed files with 4 additions and 1 deletions

View File

@ -169,7 +169,10 @@ class Frame(wx.Frame):
r.Bind(wx.EVT_RADIOBUTTON, self.choose_addr)
return r
self.heat = {i:addrbutton("%02X" % i) for i in range(0x08, 0x78)}
devgrid = wx.GridSizer(8, wx.Size(4, 6))
# Be careful here, GridSizer changed between wx 3.x and 4.x
devgrid = wx.GridSizer(8)
devgrid.SetHGap(4)
devgrid.SetVGap(6)
for i,l in sorted(self.heat.items()):
devgrid.Add(l)