diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 49c0e27d0035..c67f827e6013 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -618,7 +618,8 @@ def gui_repaint(self, drawDC=None, origin='WX'): else self.bitmap) drawDC.DrawBitmap(bmp, 0, 0) if self._rubberband_rect is not None: - x0, y0, x1, y1 = self._rubberband_rect + # Some versions of wx+python don't support numpy.float64 here. + x0, y0, x1, y1 = map(int, self._rubberband_rect) drawDC.DrawLineList( [(x0, y0, x1, y0), (x1, y0, x1, y1), (x0, y0, x0, y1), (x0, y1, x1, y1)], diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py index 5d51cf2ab9c3..346e0e2b967e 100644 --- a/lib/matplotlib/tests/test_backends_interactive.py +++ b/lib/matplotlib/tests/test_backends_interactive.py @@ -128,6 +128,8 @@ def check_alt_backend(alt_backend): "matplotlib.backends.backend_{}".format(backend)) ax.plot([0, 1], [2, 3]) + if fig.canvas.toolbar: # i.e toolbar2. + fig.canvas.toolbar.draw_rubberband(None, 1., 1, 2., 2) timer = fig.canvas.new_timer(1.) # Test floats casting to int as needed. timer.add_callback(FigureCanvasBase.key_press_event, fig.canvas, "q")