Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8511771

Browse filesBrowse files
authored
Fix canvas redraws during motion in figures with a Button or TextBox
During motion in figures with Button or TextBox widgets, the stored `color` and `hovercolor` values are compared with the current Axes facecolor. By default, the stored colors are each a string of a float, but the returned facecolor is frequently a tuple of RGBA values. The colors appear to mismatch, triggering a draw event with any motion in the figure. As a fix, convert both the color and facecolor values to RGBA format for comparison in case either value is stored in a different format.
1 parent ce6ac2d commit 8511771
Copy full SHA for 8511771

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import numpy as np
1717

1818
import matplotlib as mpl
19-
from . import cbook, ticker
19+
from . import cbook, colors, ticker
2020
from .lines import Line2D
2121
from .patches import Circle, Rectangle, Ellipse
2222
from .transforms import blended_transform_factory
@@ -220,7 +220,7 @@ def _motion(self, event):
220220
if self.ignore(event):
221221
return
222222
c = self.hovercolor if event.inaxes == self.ax else self.color
223-
if c != self.ax.get_facecolor():
223+
if not colors.same_color(c, self.ax.get_facecolor()):
224224
self.ax.set_facecolor(c)
225225
if self.drawon:
226226
self.ax.figure.canvas.draw()
@@ -920,7 +920,7 @@ def _motion(self, event):
920920
if self.ignore(event):
921921
return
922922
c = self.hovercolor if event.inaxes == self.ax else self.color
923-
if c != self.ax.get_facecolor():
923+
if not colors.same_color(c, self.ax.get_facecolor()):
924924
self.ax.set_facecolor(c)
925925
if self.drawon:
926926
self.ax.figure.canvas.draw()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.