Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82813ea

Browse files
authored
Merge pull request #17812 from meeseeksmachine/auto-backport-of-pr-17772-on-v3.3.x
Backport PR #17772 on branch v3.3.x (Partially fix rubberbanding in GTK3.)
2 parents c3ee86a + f9f262b commit 82813ea

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def set_cursor(self, cursor):
509509
def draw_rubberband(self, event, x0, y0, x1, y1):
510510
# adapted from
511511
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/189744
512-
self.ctx = self.canvas.get_property("window").cairo_create()
512+
ctx = self.canvas.get_property("window").cairo_create()
513513

514514
# todo: instead of redrawing the entire figure, copy the part of
515515
# the figure that was covered by the previous rubberband rectangle
@@ -522,11 +522,11 @@ def draw_rubberband(self, event, x0, y0, x1, y1):
522522
h = abs(y1 - y0)
523523
rect = [int(val) for val in (min(x0, x1), min(y0, y1), w, h)]
524524

525-
self.ctx.new_path()
526-
self.ctx.set_line_width(0.5)
527-
self.ctx.rectangle(rect[0], rect[1], rect[2], rect[3])
528-
self.ctx.set_source_rgb(0, 0, 0)
529-
self.ctx.stroke()
525+
ctx.new_path()
526+
ctx.set_line_width(0.5)
527+
ctx.rectangle(rect[0], rect[1], rect[2], rect[3])
528+
ctx.set_source_rgb(0, 0, 0)
529+
ctx.stroke()
530530

531531
def _update_buttons_checked(self):
532532
for name, active in [("Pan", "PAN"), ("Zoom", "ZOOM")]:

0 commit comments

Comments
 (0)