Reputation: 51
I would like to display a table of 6 buttons(cancel,delete,save,quit,stop,new), with 3 rows and 2 colunms. I tried to run this program below, but it did not work.
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()
This is the whole message error.
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
There is a problem with this line grid = wx.GridSizer(3, 2)
, but I do not manage to figure out the problem.
Upvotes: 0
Views: 3003
Reputation: 3177
As you are running Python 3.4 I presume you are using wxPython Phoenix. According to the documentation of wx.GridSizer
two int
do not match any of the allowed signatures. Use e.g. three integers instead.
EDIT: Link has slightly changed.
Upvotes: 1