[wxPython-users] wxRect DeprecationWarning

Peter Damoc pdamoc at gmail.com
Tue Oct 3 10:27:45 PDT 2006


Hi Andrea,

what I did in a similar situation last year with the 2.4 -> 2.6 migration
was to inject new functionality in the old class and to use it like the new
class...
Like this:

if wx.VERSION_STRING <"2.7":
    wx.Rect.Contains =3D lambda self, point: wx.Rect.Inside(self, point)

this way all your code is written for the new version... and you can easily
fade out the old one

Keep up the good work and remember... the changes are made to improve
wxPython... Contains makes a lot more sense than Inside.
Peter.

On 10/3/06, Andrea Gavana <andrea.gavana at gmail.com> wrote:
>
> Hello NGs,
>
>     I was trying to use the 2 new classes I wrote in the last days
> (FancyButtonPanel and FlatNotebook), and I tried both with the new 2.7
> pre-release. Well, curiously enough, the method:
>
> wx.Rect.Inside(aPoint)
>
> Has magically disappeared (deprecation warning); the new method:
>
> wx.Rect.Contains(aPoint)
>
> Should replace it. Ok, no problem for that, it's just a name.
> *However*, the Contains method didn't exist in previous versions of
> wxPython. So, what I am supposed to do with that? What if I would like
> to support both 2.6.3.3 and 2.7? Deprecating a function should be done
> after a period of co-existance with another method (Inside and
> Contains should have lived together for a while) or if this method
> doesn't do anything anymore (like DC.BeginDrawing() and
> DC.EndDrawing()).
> So, which is the alternative? Should I subclass wx.Rect() in some way
> to return Contains() instead of Inside() by checking the wxPython
> version (no idea how to do it right now)? Are there other
> alternatives?
>
> Ironically and sadly enough, these small adjustments to wx (together
> with some playing that has been done on EVT_SIZE handling) have been
> able to kill half of my widgets on wxPython (not talking about the
> effects they had on wx.Sizers). It's always a joy for me to create
> something new with wxPython, that rocks. But it's not amazing at all
> reinventing the wheel everytime because of such modifications in wx.
>
> Thank you for every suggestions, and sorry for the plea.
>
> Andrea.
>
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.virgilio.it/infinity77/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>


-- =

There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200610=
03/c5a4130f/attachment.htm


More information about the wxpython-users mailing list