TypeError: GridSizer(): arguments did not match any overloaded call

TypeError: GridSizer(): arguments did not match any overloaded call

我想显示一个 table 的 6 个按钮(取消、删除、保存、退出、停止、新建),有 3 行和 2 列。 我尝试 运行 下面的这个程序,但没有成功。

import wx

class Identifiers(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(200, 150))

        panel = wx.Panel(self, -1)
        grid = wx.GridSizer(3, 2)

        grid.AddMany([(wx.Button(panel, wx.ID_CANCEL), 0, wx.TOP | wx.LEFT, 9),
        (wx.Button(panel, wx.ID_DELETE), 0, wx.TOP, 9),
        (wx.Button(panel, wx.ID_SAVE), 0, wx.LEFT, 9),
        (wx.Button(panel, wx.ID_EXIT)),
        (wx.Button(panel, wx.ID_STOP), 0, wx.LEFT, 9),
        (wx.Button(panel, wx.ID_NEW))])

        self.Bind(wx.EVT_BUTTON, self.OnQuit, id=wx.ID_EXIT)

        panel.SetSizer(grid)
        self.Centre()
        self.Show(True)

    def OnQuit(self, event):
        self.Close()

app = wx.App()
Identifiers(None, -1, '')
app.MainLoop()

这是整个消息错误。

File "C:/Python34/Test_wxPython/Events/Identifiers.py", line 12, in __init__
    grid = wx.GridSizer(3, 2)
TypeError: GridSizer(): arguments did not match any overloaded call:
  overload 1: not enough arguments
  overload 2: argument 2 has unexpected type 'int'
  overload 3: not enough arguments
  overload 4: not enough arguments

这一行有问题grid = wx.GridSizer(3, 2),但我没能弄清楚问题所在。

如你所愿 运行 Python 3.4 我假设你正在使用 wxPython Phoenix。根据文档 of wx.GridSizer 两个 int 不匹配任何允许的签名。使用例如取而代之的是三个整数。

编辑:Link 略有更改。