Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
carandraug opened this issue Jan 5, 2024 · 2 comments
Open

Comments

@carandraug
Copy link
Contributor

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 #983 (comment) ). This has just landed in wxWidgets (see wxWidgets/wxWidgets#24187) so would be nice to have in wxPython too.

@DietmarSchwertberger
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants