M
Matthias Kluwe
Hi!
I'd like to place several StaticBoxes in a frame, but I can't get it
right.
Consider the following code:
import wx
app = wx.PySimpleApp()
frame = wx.Frame(parent=None, title="Test")
box = wx.BoxSizer(wx.VERTICAL)
frame.SetSizer(box)
upper_box = wx.StaticBox(parent=frame, label="Upper Box")
box.Add(item=upper_box, flag=wx.GROW)
upper_sizer = wx.StaticBoxSizer(upper_box)
upper_sizer.Add(wx.Button(parent=frame, label="Button"))
frame.Show()
app.MainLoop()
This should show a frame containing a StaticBox which contains a
button, but: The button is not placed within the StaticBox. Hmm.
Additionally: wx.StaticBoxSizer.__init__.__doc__ says that a
StaticBoxSizer is created by __init__(self, StaticBox box, int
orient=HORIZONTAL). But if I change the line
upper_sizer = wx.StaticBoxSizer(upper_box)
to
upper_sizer = wx.StaticBoxSizer(StaticBox=upper_box)
I get the error: TypeError: new_StaticBoxSizer() takes at least 1
argument (0 given).
What am I missing?
Regards,
Matthias
I'd like to place several StaticBoxes in a frame, but I can't get it
right.
Consider the following code:
import wx
app = wx.PySimpleApp()
frame = wx.Frame(parent=None, title="Test")
box = wx.BoxSizer(wx.VERTICAL)
frame.SetSizer(box)
upper_box = wx.StaticBox(parent=frame, label="Upper Box")
box.Add(item=upper_box, flag=wx.GROW)
upper_sizer = wx.StaticBoxSizer(upper_box)
upper_sizer.Add(wx.Button(parent=frame, label="Button"))
frame.Show()
app.MainLoop()
This should show a frame containing a StaticBox which contains a
button, but: The button is not placed within the StaticBox. Hmm.
Additionally: wx.StaticBoxSizer.__init__.__doc__ says that a
StaticBoxSizer is created by __init__(self, StaticBox box, int
orient=HORIZONTAL). But if I change the line
upper_sizer = wx.StaticBoxSizer(upper_box)
to
upper_sizer = wx.StaticBoxSizer(StaticBox=upper_box)
I get the error: TypeError: new_StaticBoxSizer() takes at least 1
argument (0 given).
What am I missing?
Regards,
Matthias