passing a tuple into a class function as a single argument
greywine at gmail.com
greywine at gmail.com
Fri Nov 26 08:38:59 EST 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)
self.Show(True)
app = wx.App(False)
size=(600,400)
frame = MyFrame(None, 'Small editor')
#frame = MyFrame(None, 'Small editor', (600,400))
app.MainLoop()
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\wxpythoneasy1.py", 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.
Thanks,
John R.
More information about the Python-list
mailing list