Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Canvas.AddArrow from FloatCanvas does not work with WxPython 4.2.0 demo

Open dbressan2 opened this issue 2 years ago • 2 comments

Operating system: Windows 10 ENTREPRISE wxPython version & source: 4.2.0 Python version & source: 3.10.6

Description of the problem: Canvas.AddArrow from FloatCanvas does not work with WxPython demo using wxPython 4.2.0. No Arrow is actually drawn.

Same demo code works with wxPython 4.1.1.

dbressan2 avatar Dec 20 '22 17:12 dbressan2

I tested on: wxPython 4.2.1 with Python 3.9 on a Mac, and it works.

However, with: wxPython 4.2.1 with Python 3.10 on a Mac

I do see the failure.

So it's a 2.9 vs 3.10 issue, which is very odd.

It *could be an issue with a new numpy -- I"ll see about fixing the numpy warnings, and see if that helps.

ChrisBarker-NOAA avatar Aug 21 '23 19:08 ChrisBarker-NOAA

Found it -- turns out wxPython used to simply truncate floats to int when you used them in a drawing call -- now it doesn't do that, and instead does mysterious things -- at least when using numpy arrays, which FloatCanvas makes heavy use of.

Anyway -- fixed in: #2448

However, I'm not sure when that might get merged -- I don't have permissions :-(

If you want to patch it yourself, you'll want the new FloatCanvas.py and DrawObjects.py

ChrisBarker-NOAA avatar Aug 21 '23 23:08 ChrisBarker-NOAA