wx.aui toolbar type int error

I’m trying to make an aui toolbar with the help of wxPython demo. Here’s the exact script that I tried (it’s also attached):

import wx

import wx.aui

try:

from agw import aui

except ImportError:

import wx.lib.agw.aui as aui

class MyFrame(wx.Frame):

def init(self, parent, id=-1, title=‘wx.aui Test’, pos=wx.DefaultPosition, size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):

wx.Frame.init(self, parent, id, title, pos, size, style)

self._mgr = wx.aui.AuiManager(self)

self.tree = wx.TreeCtrl(self, -1, wx.Point(0, 0), wx.Size(160, 250), wx.TR_DEFAULT_STYLE | wx.NO_BORDER)

root = self.tree.AddRoot(“AUI Project”)

tb4 = aui.AuiToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, agwStyle=aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT | aui.AUI_TB_HORZ_TEXT)

tb4.SetToolBitmapSize(wx.Size(16, 16))

tb4_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16))

tb4.AddSimpleTool(-1, “Item 1”, tb4_bmp1)

tb4.AddSimpleTool(-1, “Item 2”, tb4_bmp1)

self._mgr.AddPane(tb4, aui.AuiPaneInfo().Name(“tb4”).Caption(“Sample Bookmark Toolbar”).ToolbarPane().Top())

I also tested self._mgr.AddPane(tb4, wx.TOP) and I got an error as well.

self._mgr.AddPane(self.tree, wx.LEFT, ‘Window Navigator’)

self._mgr.Update()

app = wx.App()

frame = MyFrame(None)

frame.Show()

When I run it, the line “self._mgr.AddPane(tb4, …)” gives me a “expected argument 3 type int” error. Which part is wrong?

Regards.

auitoolbar.py (1.21 KB)

I'm trying to make an aui toolbar with the help of wxPython demo. Here's
the exact script that I tried (it's also attached):

import wx.aui

...

     import wx.lib.agw.aui as aui

...

         self._mgr = wx.aui.AuiManager(self)

...

         tb4 = aui.AuiToolBar(self, -1, wx.DefaultPosition,
wx.DefaultSize, agwStyle=aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_OVERFLOW
> aui.AUI_TB_TEXT | aui.AUI_TB_HORZ_TEXT)

...

         self._mgr.AddPane(tb4,
aui.AuiPaneInfo().Name("tb4").Caption("Sample Bookmark
Toolbar").ToolbarPane().Top())

When I run it, the line "self._mgr.AddPane(tb4, ....)" gives me a
"expected argument 3 type int" error. Which part is wrong?

You are using and mixing two different implementations of the AUI classes. Take out the first import and change your use of "wx.aui." to "aui." and it should work. After you add a call to app.MainLoop().

···

On 1/11/11 10:58 PM, jeprox script wrote:

--
Robin Dunn
Software Craftsman