passing a tuple into a class function as a single argument

greywine at greywine at
Fri Nov 26 14:38:59 CET 2010

Hi everyone,

The following program doesn't work as expected:

#Python 2.7 & wxPython 2.9

import wx

class MyFrame(wx.Frame):
    """ We simply derive a new class of Frame. """
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title, size=(200,100))
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)

app = wx.App(False)
frame = MyFrame(None, 'Small editor')
#frame = MyFrame(None, 'Small editor', (600,400))

If I use the default size=(200,100) it's just fine.  But if I try it
pass it a new size (600,400), I get the following error:
Traceback (most recent call last):
  File "C:\Python27\", line 13, in <module>
    frame = MyFrame(None, 'Small editor',((600,400)))
TypeError: __init__() takes exactly 3 arguments (4 given)

It seems like it's begging to have it pass a different size than the
default, but there doesn't seem to be a way to pass a tuple as a
single argument.

Any help would be appreciate.


John R.

More information about the Python-list mailing list