Skip to content

gh-119459: Fix HiDPI blurring of every program window that using tkinter#119902

Open
Wulian233 wants to merge 8 commits intopython:mainfrom
Wulian233:pr
Open

gh-119459: Fix HiDPI blurring of every program window that using tkinter#119902
Wulian233 wants to merge 8 commits intopython:mainfrom
Wulian233:pr

Conversation

@Wulian233
Copy link
Copy Markdown
Contributor

@Wulian233 Wulian233 commented Jun 1, 2024

Refer #119459 , we believe this is a tk/tkinter bug that should be fixed in tkinter. In this PR, I added the fix code to tkinter/__init__.py, which fixes the window blurring problem that every program that uses tkinter has. Since I had already committed fix for turtledemo and terryjreedy fix IDLE earlier, I removed them here. Also #119175 was backported to 3.12 3.13 and I think this PR should be as well.

↓Fix
fix

Comment thread Lib/tkinter/__init__.py Outdated
Comment thread Lib/tkinter/__init__.py Outdated
Comment thread Lib/tkinter/__init__.py
# CALL BEFORE ANY TK OPERATIONS!
# URL for arguments for the ...Awareness call below.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my humble opinion, can you guarantee that this code will not be called repeatedly? Maybe it only needs to be called once?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a print statement to your code and just try the code below:

from tkinter import messagebox

messagebox.showinfo("info", "test")
messagebox.showinfo("info", "test")

Then you'll find that it runs twice.

@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants