I'm trying to create a panel, with four boxes containing some data. These four boxes should have a predefined static size. What I have so far is four boxes that is overlapping to some extent.
Any ideas?
Code:
import wx
class MyFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.pl = wx.Panel(self)
self.SetSize((500, 350))
sb = wx.StaticBox(self.pl, -1, 'BOX0', size=(180, 150))
sat = wx.CheckBox(self.pl, -1, 'Satellite')
gsm = wx.CheckBox(self.pl, -1, 'GSM')
wlan = wx.CheckBox(self.pl, -1, 'WLAN')
sb2 = wx.StaticBox(self.pl, -1, 'BOX1', size=(180, 150))
nm2 = wx.StaticText(self.pl, -1, 'default1')
sb3 = wx.StaticBox(self.pl, -1, 'BOX2', size=(180, 150))
nm3 = wx.StaticText(self.pl, -1, 'default2')
sb4 = wx.StaticBox(self.pl, -1, 'BOX3', size=(180, 150))
nm4 = wx.StaticText(self.pl, -1, 'default3')
box = wx.StaticBoxSizer(sb, wx.VERTICAL)
box.Add(sat, 0, wx.ALL, 5)
box.Add(gsm, 0, wx.ALL, 5)
box.Add(wlan, 0, wx.ALL, 5)
box2 = wx.StaticBoxSizer(sb2)
box2.Add(nm2, 0, wx.ALL, 5)
box3 = wx.StaticBoxSizer(sb3)
box3.Add(nm3, 0, wx.ALL, 5)
box4 = wx.StaticBoxSizer(sb4)
box4.Add(nm4, 0, wx.ALL, 5)
gs = wx.BoxSizer(wx.HORIZONTAL)
gs.Add(box)
gs.Add(box2)
gss = wx.BoxSizer(wx.HORIZONTAL)
gss.Add(box3)
gss.Add(box4)
gt = wx.BoxSizer(wx.VERTICAL)
gt.Add(gs)
gt.Add(gss)
self.pl.SetSizer(gt)
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, '08_gridsizer.py')
frame.Show()
self.SetTopWindow(frame)
return 1
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()