0

运行此代码会导致错误

import wx

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, args, kwargs)
        self.Show()

app = wx.App()
frame = MyFrame(None)
app.MainLoop()


Traceback (most recent call last):
  File "testing.py", line 10, in <module>
    frame = MyFrame(None)
  File "testing.py", line 6, in __init__
    wx.Frame.__init__(self, args, kwargs)
  File "C:\Python27\lib\site-packages\wx-2.9.4-msw\wx\_windows.py", line 580, in __init__
    _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
TypeError: in method 'new_Frame', expected argument 1 of type 'wxWindow *'

是否可以在 wxpython 中使用 *args 和 **kwargs 作为位置和命名参数?

4

1 回答 1

4
wx.Frame.__init__(self, *args, **kwargs)

它工作正常...... btu 你需要正确传递它们

于 2013-05-13T03:34:51.643 回答