wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.21k stars 509 forks source link

add support to divide wxRealPoint and wxPoint with a floating point #2506

Open carandraug opened 4 months ago

carandraug commented 4 months ago

Operating system: Debian 12 wxPython version & source: "4.2.0 gtk3 (phoenix) wxWidgets 3.2.2" (as packaged in Debian 12) Python version & source: "Python 3.11.2" (as packaged in Debian 12)

Description of the problem:

Dividing a wx.RealPoint with a float fails (multiplication with a float and division with a int work fine).

>>> import wx
>>> wx.version()
'4.2.0 gtk3 (phoenix) wxWidgets 3.2.2'
>>> wx.RealPoint(2.0, 2.0) / 2
wx.RealPoint(1.0, 1.0)
>>> wx.RealPoint(2.0, 2.0) * 2.0
wx.RealPoint(4.0, 4.0)
>>> wx.RealPoint(2.0, 2.0) / 2.0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'RealPoint' and 'float'

This is because it was not implemented in wxWidgets itself (as mentioned in https://github.com/wxWidgets/Phoenix/pull/983#issuecomment-417404504 ). This has just landed in wxWidgets (see wxWidgets/wxWidgets#24187) so would be nice to have in wxPython too.

DietmarSchwertberger commented 4 months ago

You could probably implement this yourself by looking at etg\gdicmn.py: Look at the section # wxSize tweaks. Having a change in wxWidgets does not mean that it's available immediately in wxPython, though. Even if e.g. VZ would backport it to the 3.2 branch, wxPython is not yet pointing to the latest version of 3.2.

Metallicow commented 4 months ago

Yea wxPython is like a wx.Timer for wxWidgets. Don't hold your breath, but just know it is on a TODO/"Bug list" somewhere in the universe. LOL