wxpython 错误 解答

我在wxpython中输入

import wx

class bucky(wx.Frame):

    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Frame aka window',size=(300.200))
        panel=wx.Panel(self)

        status=self.CreateStatusBar()
        menubar=wx.MenuBar()
        first=wx.Menu()
        second=wx.Menu()
        first.Append(wx.NewId(),"New Window","This is a new window")
        first.Append(wx.NewId(),"open...","this will open a new window")
        menubar.Append(first,"File")
        menubar.Append(second,"Edit")
        self.SetMenuBar(menubar)

if __name__=='__main__':
    app=wx.PySimpleApp()
    frame=bucky(parent=None,id=-1)
    frame.Show()
    app.MainLoop()
  ------------------------------------------------------------------------   
run以后,出现以下类型错误提示

Traceback (most recent call last):
  File "C:\Python27\bucky3.py", line 21, in <module>
    frame=bucky(parent=None,id=-1)
  File "C:\Python27\bucky3.py", line 6, in __init__
    wx.Frame.__init__(self,parent,id,'Frame aka window',size=(300.200))
  File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", line 505, in __init__
    _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
TypeError: Expected a 2-tuple of integers or a wxSize object.


请问到底该如何修改?

作者: taiduoyi   发布时间: 2011-06-09

wx.Frame.__init__(self,parent,id,'Frame aka window',size=(300.200))

应该为 (300, 200)

作者: greatghoul   发布时间: 2011-06-09