mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
Since numpy 1.20 the aliases np.int and np.float are deprecated (see https://numpy.org/devdocs/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated). The buildin types should be used instead. Since numpy 1.24 an AttributeError exception is thrown when np.int or np.float is used.
This commit is contained in:
@@ -21,7 +21,7 @@ if ver == 'installed': ## import the installed version
|
|||||||
from wx.lib.floatcanvas import FloatCanvas
|
from wx.lib.floatcanvas import FloatCanvas
|
||||||
print("using installed version:", wx.lib.floatcanvas.__version__)
|
print("using installed version:", wx.lib.floatcanvas.__version__)
|
||||||
elif ver == 'local':
|
elif ver == 'local':
|
||||||
## import a local version
|
## import a local version
|
||||||
import sys
|
import sys
|
||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
from floatcanvas import NavCanvas
|
from floatcanvas import NavCanvas
|
||||||
@@ -49,7 +49,7 @@ class MovingObjectMixin: # Borrowed from MovingElements.py
|
|||||||
|
|
||||||
class Ball(MovingObjectMixin, FloatCanvas.Circle):
|
class Ball(MovingObjectMixin, FloatCanvas.Circle):
|
||||||
def __init__(self, XY, Velocity, Radius=2.0, **kwargs):
|
def __init__(self, XY, Velocity, Radius=2.0, **kwargs):
|
||||||
self.Velocity = np.asarray(Velocity, np.float).reshape((2,))
|
self.Velocity = np.asarray(Velocity, float).reshape((2,))
|
||||||
self.Radius = Radius
|
self.Radius = Radius
|
||||||
self.Moving = False
|
self.Moving = False
|
||||||
FloatCanvas.Circle.__init__(self, XY, Diameter=Radius*2, FillColor="red", **kwargs)
|
FloatCanvas.Circle.__init__(self, XY, Diameter=Radius*2, FillColor="red", **kwargs)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class PixelBitmap:
|
|||||||
else:
|
else:
|
||||||
raise FC.FloatCanvasError("PixelBitmap takes only a wx.Bitmap or a wx.Image as input")
|
raise FC.FloatCanvasError("PixelBitmap takes only a wx.Bitmap or a wx.Image as input")
|
||||||
|
|
||||||
self.XY = np.asarray(XY, dtype=np.int).reshape((2,))
|
self.XY = np.asarray(XY, dtype=int).reshape((2,))
|
||||||
self.Position = Position
|
self.Position = Position
|
||||||
|
|
||||||
(self.Width, self.Height) = self.Bitmap.GetWidth(), self.Bitmap.GetHeight()
|
(self.Width, self.Height) = self.Bitmap.GetWidth(), self.Bitmap.GetHeight()
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ class PolyMarker(PolyPoints):
|
|||||||
def _circle(self, dc, coords, size=1):
|
def _circle(self, dc, coords, size=1):
|
||||||
fact = 2.5 * size
|
fact = 2.5 * size
|
||||||
wh = 5.0 * size
|
wh = 5.0 * size
|
||||||
rect = np.zeros((len(coords), 4), np.float) + [0.0, 0.0, wh, wh]
|
rect = np.zeros((len(coords), 4), float) + [0.0, 0.0, wh, wh]
|
||||||
rect[:, 0:2] = coords - [fact, fact]
|
rect[:, 0:2] = coords - [fact, fact]
|
||||||
dc.DrawEllipseList(rect.astype(np.int32))
|
dc.DrawEllipseList(rect.astype(np.int32))
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ class PolyMarker(PolyPoints):
|
|||||||
def _square(self, dc, coords, size=1):
|
def _square(self, dc, coords, size=1):
|
||||||
fact = 2.5 * size
|
fact = 2.5 * size
|
||||||
wh = 5.0 * size
|
wh = 5.0 * size
|
||||||
rect = np.zeros((len(coords), 4), np.float) + [0.0, 0.0, wh, wh]
|
rect = np.zeros((len(coords), 4), float) + [0.0, 0.0, wh, wh]
|
||||||
rect[:, 0:2] = coords - [fact, fact]
|
rect[:, 0:2] = coords - [fact, fact]
|
||||||
dc.DrawRectangleList(rect.astype(np.int32))
|
dc.DrawRectangleList(rect.astype(np.int32))
|
||||||
|
|
||||||
@@ -1199,7 +1199,7 @@ class PolyBoxPlot(PolyPoints):
|
|||||||
size = 0.5
|
size = 0.5
|
||||||
fact = 2.5 * size
|
fact = 2.5 * size
|
||||||
wh = 5.0 * size
|
wh = 5.0 * size
|
||||||
rect = np.zeros((len(pt_data), 4), np.float) + [0.0, 0.0, wh, wh]
|
rect = np.zeros((len(pt_data), 4), float) + [0.0, 0.0, wh, wh]
|
||||||
rect[:, 0:2] = pt_data - [fact, fact]
|
rect[:, 0:2] = pt_data - [fact, fact]
|
||||||
dc.DrawRectangleList(rect.astype(np.int32))
|
dc.DrawRectangleList(rect.astype(np.int32))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user