Well, there are a couple of issues
- you haven't added the
TextCtrl
to theBoxSizer
, so it won't get laid out - you haven't set the sizer for the
Frame
You can do something like this...
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Test")
self.SetSize((600,500))
toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.NO_BORDER)
toolbar.Realize()
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(toolbar, 0, border=5)
vbox.Add(self.control, 1, border=5)
self.SetSizer(vbox)
...but it's probably better to use the Frame
's CreateToolBar()
method, then you don't have to worry about its layout...
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Test")
self.SetSize((600,500))
toolbar = self.CreateToolBar(style=wx.TB_HORIZONTAL | wx.NO_BORDER)
toolbar.Realize()
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(self.control, 1, border=5)
self.SetSizer(vbox)
...indeed, if the TextCtrl
is the only other thing in the frame, you don't even need the sizer...
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "Test")
self.SetSize((600,500))
toolbar = self.CreateToolBar(style=wx.TB_HORIZONTAL | wx.NO_BORDER)
toolbar.Realize()
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)