开发者

Adding an AuiToolbar causes "expected argument 3 type int"

When I use the code below and I run the small app, the frame doesn't even show up and the line that says "self._mgr.AddPane(tb4, aui.AuiPaneInfo...." gives me a "expected argument 3 type int" error. I'm using Python 2.7 and wxPython 2.8. What is the proper way of doing t开发者_如何学运维his?

import wx
import wx.aui

# The lines below are copied/pasted from wxPython aui demo
try:
    from agw import aui
except ImportError:
    import wx.lib.agw.aui as aui
# End of copy/paste

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")

        # The lines below here were basically copied and pasted from wxPython demo
        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())
        # End of copy and paste

        p = wx.Panel(self, -1)
        p.SetBackgroundColour(wx.GREEN)
        self._mgr.AddPane(self.tree, wx.LEFT, 'Window Navigator')
        self._mgr.AddPane(p, wx.CENTER, 'What')
        self._mgr.Update()


app = wx.App()
frame = MyFrame(None)
frame.Show()
app.MainLoop()


Answered on the mail list: http://groups.google.com/group/wxpython-users/browse_thread/thread/f50720ea009345e3#

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜