Reputation:
How would i implement a static box within another static box in wxpython ontop of the panel?
I am trying to accomplish this because i am grouping buttons for different things.
thankyou.
Upvotes: 1
Views: 273
Reputation: 9451
You have to use StaticBoxSizer
import wx
class MainWindow(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.panel = wx.Panel(self)
self.box1 = wx.StaticBox(self.panel, label="One")
self.box2 = wx.StaticBox(self.panel, label="Two")
self.box_sizer = wx.StaticBoxSizer(self.box1, wx.HORIZONTAL)
self.box_sizer.Add(self.box2, 1, wx.ALL | wx.EXPAND, 5)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.box_sizer, 1, wx.ALL | wx.EXPAND, 5)
self.panel.SetSizerAndFit(self.sizer)
self.Show()
if __name__ == "__main__":
app = wx.App(False)
win = MainWindow(None)
app.MainLoop()
Upvotes: 1