From 28b7ba579442c5e2f1e1c961f9512b5668d2e2b4 Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Wed, 29 Dec 2021 23:23:33 -0500 Subject: [PATCH] Fix Python 3.10 in lib.plot Fixes drawing lines --- wx/lib/plot/polyobjects.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wx/lib/plot/polyobjects.py b/wx/lib/plot/polyobjects.py index 65af785b..2937794a 100644 --- a/wx/lib/plot/polyobjects.py +++ b/wx/lib/plot/polyobjects.py @@ -425,6 +425,7 @@ class PolyLine(PolyPoints): for c1, c2 in zip(self.scaled, self.scaled[1:]): self._path(dc, c1, c2, drawstyle) else: + coord = [(int(c[0]), int(c[1])) for c in coord] dc.DrawLines(coord) # draw legend line def getSymExtent(self, printerScale): @@ -478,6 +479,7 @@ class PolyLine(PolyPoints): err_txt = "Invalid drawstyle '{}'. Must be one of {}." raise ValueError(err_txt.format(drawstyle, self._drawstyles)) + line = [(int(p[0]), int(p[1])) for p in line] dc.DrawLines(line) @@ -523,8 +525,9 @@ class PolySpline(PolyLine): dc.SetPen(pen) if coord is None: if len(self.scaled) >= 3: - dc.DrawSpline(self.scaled) + dc.DrawSpline(self.scaled.astype(np.int32)) else: + coord = [(int(c[0]), int(c[1])) for c in coord] dc.DrawLines(coord) # draw legend line