- wx.Window(self, -1).SetBackgroundColour(wx.NamedColour("WHITE"))
-
- # Use the wxFrame internals to create the toolbar and associate it all
- # in one tidy method call.
- tb = self.CreateToolBar( wx.TB_HORIZONTAL
- | wx.NO_BORDER
- | wx.TB_FLAT
- #| wx.TB_TEXT
- )
-
- # Here's a 'simple' toolbar example, and how to bind it using SetToolBar()
- #tb = wx.ToolBarSimple(self, -1, wx.DefaultPosition, wx.DefaultSize,
- # wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
- #self.SetToolBar(tb)
- # But we're doing it a different way here.
+ client = wx.Panel(self)
+ client.SetBackgroundColour(wx.NamedColour("WHITE"))
+
+ if FRAMETB:
+ # Use the wxFrame internals to create the toolbar and
+ # associate it all in one tidy method call. By using
+ # CreateToolBar or SetToolBar the "client area" of the
+ # frame will be adjusted to exclude the toolbar.
+ tb = self.CreateToolBar( TBFLAGS )
+
+ # Here's a 'simple' toolbar example, and how to bind it using SetToolBar()
+ #tb = wx.ToolBarSimple(self, -1, wx.DefaultPosition, wx.DefaultSize,
+ # wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
+ #self.SetToolBar(tb)
+ # But we're doing it a different way here.
+
+ else:
+ # The toolbar can also be a child of another widget, and
+ # be managed by a sizer, although there may be some
+ # implications of doing this on some platforms.
+ tb = wx.ToolBar(client, style=TBFLAGS)
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ sizer.Add(tb, 0, wx.EXPAND)
+ client.SetSizer(sizer)
+