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

Fix Tk error when updating toolbar checkbutton images#22841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:mainfromdaniilS:tk_toolbar_colours_fix
Apr 14, 2022
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletionslib/matplotlib/backends/_backend_tk.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -669,9 +669,13 @@ def _recolor_icon(image, color):
button._ntimage_alt = image_alt

if _is_dark("background"):
button.configure(image=image_alt)
# For Checkbuttons, we need to set `image` and `selectimage` at
# the same time. Otherwise, when updating the `image` option
# (such as when changing DPI), if the old `selectimage` has
# just been overwritten, Tk will throw an error.
image_kwargs = {"image": image_alt}
else:
button.configure(image=image)
image_kwargs = {"image": image}
# Checkbuttons may switch the background to `selectcolor` in the
# checked state, so check separately which image it needs to use in
# that state to still ensure enough contrast with the background.
Expand All@@ -689,11 +693,11 @@ def _recolor_icon(image, color):
r2, g2, b2 = _get_color("activebackground")
selectcolor = ((r1+r2)/2, (g1+g2)/2, (b1+b2)/2)
if _is_dark(selectcolor):
button.configure(selectimage=image_alt)
image_kwargs["selectimage"] =image_alt
else:
button.configure(selectimage=image)
image_kwargs["selectimage"] =image

button.configure(height='18p', width='18p')
button.configure(**image_kwargs,height='18p', width='18p')

def _Button(self, text, image_file, toggle, command):
if not toggle:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp