Discussion:
Cannot init a wx.Rect2D
Zhao Dapu
2007-06-19 06:58:34 UTC
Permalink
Hi, all
import wx
rect = wx.Rect2D(1.0, 2.0, 3.0, 4.0)
---------------------------------------------------------------------------
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 1682
, in __init__
_core_.Rect2D_swiginit(self,_core_.new_Rect2D(*args, **kwargs))
TypeError: in method 'new_Rect2D', expected argument 1 of type 'wxDouble'
rect = wx.Rect2D() # OK!
rect.Set(1,2,3,4) # Same error as above
So, why? I use the wx.Point2D class without any problem. Why this
doesn't work? What is a wxDouble? I notice other methods require
wxDouble arguments in wx.GraphicContext can work well.

Thanks
Eric Ongerth
2007-06-19 14:44:13 UTC
Permalink
Perhaps try wrapping each of the arguments with wx.Double(), for example
wx.Double(1.0), wx.Double(2.0)...

(just a guess, since wxDouble doesn't appear in wx.chm)
Post by Zhao Dapu
Hi, all
import wx
rect = wx.Rect2D(1.0, 2.0, 3.0, 4.0)
---------------------------------------------------------------------------
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 1682
, in __init__
_core_.Rect2D_swiginit(self,_core_.new_Rect2D(*args, **kwargs))
TypeError: in method 'new_Rect2D', expected argument 1 of type 'wxDouble'
rect = wx.Rect2D() # OK!
rect.Set(1,2,3,4) # Same error as above
So, why? I use the wx.Point2D class without any problem. Why this
doesn't work? What is a wxDouble? I notice other methods require
wxDouble arguments in wx.GraphicContext can work well.
Thanks
---------------------------------------------------------------------
Robin Dunn
2007-06-19 18:02:48 UTC
Permalink
Post by Zhao Dapu
Hi, all
import wx
rect = wx.Rect2D(1.0, 2.0, 3.0, 4.0)
---------------------------------------------------------------------------
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 1682
, in __init__
_core_.Rect2D_swiginit(self,_core_.new_Rect2D(*args, **kwargs))
TypeError: in method 'new_Rect2D', expected argument 1 of type 'wxDouble'
rect = wx.Rect2D() # OK!
rect.Set(1,2,3,4) # Same error as above
So, why? I use the wx.Point2D class without any problem. Why this
doesn't work?
It's a bug and will be fixed in the next release.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Loading...