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

FloatCanvas triggers DeprecationWarning from Numpy 1.25.0 or later for 'sometrue' #2498

Open
reticulatus opened this issue Dec 16, 2023 · 0 comments

Comments

@reticulatus
Copy link
Contributor

Operating system: Linux Mint 21.2
wxPython version & source: 4.2.1 from pypi
Python version & source: 3.10.12 from distro
Numpy version & source: 1.26.2 from pypi

Description of the problem:

I copied the code from the docs for the FloatCanvas package into a small test app (see example below).

When I ran the app, it output the following warning:

/home/richardt/Development/python/exp/hci/wxpython/float_canvas/float_canvas_1.py:25: DeprecationWarning: `sometrue` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `any` instead.
  self.Canvas.Draw()

Line 604 in FloatCanvas.py for the FloatCanvas.Draw() method contains:

        if N.sometrue(self.PanelSize <= 2 ):

I did a recursive search of my wxPython 4.2.1 installation and found that sometrue also occurs in line 2047 of lib/plot/plotcanvas.py:

             if np.sometrue(
Code Example (click to expand)
import wx
from wx.lib.floatcanvas import FloatCanvas

class MyFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)

        self.Canvas = FloatCanvas.FloatCanvas(self, -1,
                                     size=(500, 500),
                                     ProjectionFun=None,
                                     Debug=0,
                                     BackgroundColor="White",
                                     )

        # add a circle
        cir = FloatCanvas.Circle((10, 10), 100)
        self.Canvas.AddObject(cir)

        # add a rectangle
        rect = FloatCanvas.Rectangle((110, 10), (100, 100), FillColor='Red')
        self.Canvas.AddObject(rect)

        self.Canvas.Draw()

app = wx.App()
frame = MyFrame(None)
frame.Show()
app.MainLoop()
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

1 participant