调用函数时出现Type错误

时间:2013-04-18 06:09:32

标签: python wxpython typeerror

我是python的新手,我正在使用wxpython进行GUI。

我的代码的几行是:

         def __init__(self):
             panel=wx.Panel(self, -1)
             but1 = wx.Button(panel, " name", pos, size)
             self.Bind(wx.EVT_BUTTON, self.Click, but1)
         def Click(self, event):

              subprocess.call(" **************", shell=True)

我收到类型错误:

          Traceback (most recent call last):
          File "create.py", line 122, in <module>
          Build().Show()
          File "create.py", line 59, in __init__
          self.Bind(wx.EVT_BUTTON,self.Click,but1)
          File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 3918, in Bind
          event.Bind(self, id, id2, handler)              
          File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 3992, in Bind
          target.Click(id1, id2, et, function)
          TypeError: Connect() takes exactly 2 arguments (5 given)

除了“点击”功能外,我已经注释了所有内容,但仍然可以获得此功能。请告诉我我做错了什么以及如何解决它?

0 个答案:

没有答案