Cannot init a wx.Rect2D

Hi, all

I can't init a wx.Rect2D object, as following:

···

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

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)

···

On 6/18/07, Zhao Dapu zhaodapu@gmail.com wrote:

Hi, all

I can’t init a wx.Rect2D object, as following:

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


To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Zhao Dapu wrote:

Hi, all

I can't init a wx.Rect2D object, as following:

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!