FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix app icon bug on Windows when running IPython by ayshih · Pull Request #32360 · matplotlib/matplotlib · GitHub

Repository navigation

Fix app icon bug on Windows when running IPython - #32360

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
ayshih:tk_app_icon
Sep 24, 2026
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
ayshih:tk_app_icon

Conversation

ayshih commented Sep 17, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

PR summary

When running IPython on Windows and using one of the Tk backends, the app icon for a new matplotlib window can incorrectly be the default Tk icon instead of the matplotlib icon. Apparently the IPython event loop suppresses the Tk event loop in such a manner that the setting of the app icon may not go through if Tk has not been used for a while in the IPython session.

To see the bug, run the following on Windows in an interactive IPython session:

import matplotlib
matplotlib.use('tkagg')  # TkCairo is also bugged
import matplotlib.pyplot as plt

plt.figure(); plt.show()
# note the correct matplotlib icon

# close the window, and then wait ~10 seconds

plt.figure(); plt.show()
# note the incorrect icon

# close the window and do not wait before continuing

plt.figure(); plt.show()
# note the correct icon

This PR explicitly calls .update() right after setting the icon to ensure that the icon change is actually processed. (calling update() is discouraged, xref #17789)

This PR moves the icon-setting code to right after the new window is shown for the first time, and the bug stops happening.

AI Disclosure

No AI was used

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • [N/A] New and changed code is tested
  • [N/A] Plotting related features are demonstrated in an example
  • [N/A] New features and API changes have release notes
  • [N/A] Documentation complies with general and docstring guidelines

ayshih marked this pull request as draft September 17, 2026 14:28
ayshih marked this pull request as ready for review September 17, 2026 15:54
ayshih added this to the v3.11.3 milestone Sep 17, 2026

QuLogic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I trust you that this fixes things. It doesn't seem strange otherwise.

QuLogic merged commit 620348a into matplotlib:main Sep 24, 2026
38 of 39 checks passed

lumberbot-app Bot commented Sep 24, 2026

Copy link
Copy Markdown

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:
They assume that the base project is the Git remote upstream and your fork is origin.

  1. Update backport branch.
git fetch upstream v3.11.x:v3.11.x
# or `git pull upstream v3.11.x` if you are on v3.11.x
  1. Create PR branch.
git switch -c auto-backport-of-pr-32360-on-v3.11.x v3.11.x
  1. Cherry pick the first parent branch of this PR on top of the older branch:
git cherry-pick -x -m1 620348acc3bc93cd05b5a712c74c76387fe3c7a9
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #32360: Fix app icon bug on Windows when running IPython'
  1. Push to a named branch:
git push --set-upstream origin auto-backport-of-pr-32360-on-v3.11.x
  1. Create a PR against branch v3.11.x, I would have named this PR:

Backport PR #32360 on branch v3.11.x (Fix app icon bug on Windows when running IPython)

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

ayshih deleted the tk_app_icon branch September 24, 2026 20:42
iccir pushed a commit that referenced this pull request Sep 25, 2026
iccir added a commit that referenced this pull request Sep 25, 2026
Backport PR #32360 on branch v3.11.x (Fix app icon bug on Windows when running IPython)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL