Skip to content

Commit 333fcaf

Browse files
committed
Fix rubberband visibility for wx backend
1 parent e98d8d0 commit 333fcaf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/matplotlib/backends/backend_wx.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ def __init__(self, parent, id, figure=None):
508508
_log.debug("%s - __init__() - bitmap w:%d h:%d", type(self), w, h)
509509
self._isDrawn = False
510510
self._rubberband_rect = None
511+
self._rubberband_pen_black = wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH)
512+
self._rubberband_pen_white = wx.Pen('WHITE', 1, wx.PENSTYLE_SOLID)
511513

512514
self.Bind(wx.EVT_SIZE, self._on_size)
513515
self.Bind(wx.EVT_PAINT, self._on_paint)
@@ -626,10 +628,10 @@ def gui_repaint(self, drawDC=None):
626628
if self._rubberband_rect is not None:
627629
# Some versions of wx+python don't support numpy.float64 here.
628630
x0, y0, x1, y1 = map(int, self._rubberband_rect)
629-
drawDC.DrawLineList(
630-
[(x0, y0, x1, y0), (x1, y0, x1, y1),
631-
(x0, y0, x0, y1), (x0, y1, x1, y1)],
632-
wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))
631+
rect = [(x0, y0, x1, y0), (x1, y0, x1, y1),
632+
(x0, y0, x0, y1), (x0, y1, x1, y1)]
633+
drawDC.DrawLineList(rect, self._rubberband_pen_white)
634+
drawDC.DrawLineList(rect, self._rubberband_pen_black)
633635

634636
filetypes = {
635637
**FigureCanvasBase.filetypes,

0 commit comments

Comments
 (0)