Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Wulian233
Copy link
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

Lib/tkinter/__init__.py Outdated Show resolved Hide resolved
Lib/tkinter/__init__.py Outdated Show resolved Hide resolved
# 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
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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants