照着书打的,看了一下没打错,为什么编译报错
import wxclass MyFrame(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'用户登录',size=(400,300))
panel=wx.Panel(self)
self.title=wx.StaticText(panel,label="请输入用户名和密码")
vsizer=wx.BoxSizer(wx.VERTICAL)
vsizer.Add(self.title,proportion=0,flag=wx.BOTTOM|wx.TOP|wx.ALIGN_CENTER,border=15)
panel.SetSize(vsizer)
if __name__=='__main__':
app=wx.App()
frame=MyFrame(parent=None,id=-1)
frame.Show()
app.MainLoop()
就是这个错误:
Traceback (most recent call last):
File "<pyshell#8>", line 3, in <module>
frame=MyFrame(parent=None,id=-1)
File "<pyshell#2>", line 8, in __init__
panel.SetSize(vsizer)
TypeError: Window.SetSize(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'BoxSizer'
overload 2: argument 1 has unexpected type 'BoxSizer'
overload 3: argument 1 has unexpected type 'BoxSizer'
overload 4: argument 1 has unexpected type 'BoxSizer'