Stock Events with Stock IDs

CreateToolBar is a frame method. But you don't need it to create a tool bar.

Following is exerpt from the toolbar demo:

        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)

It shows clearly howto create tool bar with non-frame parents.

···

On 8/16/07, mike@pythonlibrary.org <mike@pythonlibrary.org> wrote:

When I try using a panel for the parent, I get the following:

Traceback (most recent call last):
File "L:\PyPrograms\PyAuctions\PyLive.py", line 442, in -toplevel-
    app = Form()
File "L:\PyPrograms\PyAuctions\PyLive.py", line 31, in __init__
   self.createWidgets()
File "L:\PyPrograms\PyAuctions\PyLive.py", line 64, in createWidgets
   self.createNotebook() # need to instantiate control here for correct
tab order
File "L:\PyPrograms\PyAuctions\PyLive.py", line 86, in createNotebook
   self.MakeToolBarOrig(self.descTab)
File "L:\PyPrograms\PyAuctions\PyLive.py", line 135, in MakeToolBarOrig
   tbar = parent.CreateToolBar()
AttributeError: 'Panel' object has no attribute 'CreateToolBar'

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn