Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit8511771

Browse 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 parentce6ac2d commit8511771

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎lib/matplotlib/widgets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
importnumpyasnp
1717

1818
importmatplotlibasmpl
19-
from .importcbook,ticker
19+
from .importcbook,colors,ticker
2020
from .linesimportLine2D
2121
from .patchesimportCircle,Rectangle,Ellipse
2222
from .transformsimportblended_transform_factory
@@ -220,7 +220,7 @@ def _motion(self, event):
220220
ifself.ignore(event):
221221
return
222222
c=self.hovercolorifevent.inaxes==self.axelseself.color
223-
ifc!=self.ax.get_facecolor():
223+
ifnotcolors.same_color(c,self.ax.get_facecolor()):
224224
self.ax.set_facecolor(c)
225225
ifself.drawon:
226226
self.ax.figure.canvas.draw()
@@ -920,7 +920,7 @@ def _motion(self, event):
920920
ifself.ignore(event):
921921
return
922922
c=self.hovercolorifevent.inaxes==self.axelseself.color
923-
ifc!=self.ax.get_facecolor():
923+
ifnotcolors.same_color(c,self.ax.get_facecolor()):
924924
self.ax.set_facecolor(c)
925925
ifself.drawon:
926926
self.ax.figure.canvas.draw()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp