-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
Windows: Enable DPI awareness #611
base: master
Are you sure you want to change the base?
Conversation
This fixes blurry fonts on Windows on displays with scaling factors higher than 100%.
Hello, Interesting. I've read more into the description of what it does and what are the possibilities, and it doesn't exactly seem it's something that this application needs, at least not in this form. Setting anything other than The good news is that TkInter apparently has a relatively easy way to scale itself, via the Refs I found, might be worth looking into:
What do you think? I guess I could get into testing all this, but I'm currently working on #586 and #590, and they're kinda more important than this. If not, I can simply test this at a later date. |
Thanks for the answer. The timing of this is a bit unfortunate, though. I just lost access to the testing laptop that had a HiDPI display, so now I'll have to test this on a regular display.... :P
That's what I expected, too, but for some reason, Windows doesn't to scale the fonts automatically, so everything looks blurry. :( I don't know Windows enough to understand why simply calling
At least that one I can confirm it doesn't happen (I'm using a 150% scaling factor now because I don't have my testing laptop anymore):
Maybe I'm just dumb, but that wiki page looks rather complicated. It mentions having to know the physical dimensions of the screen to calculate the DPI correctly:
I tried a naive approach, and simply hardcoded the scaling to diff --git a/main.py b/main.py
index 00d536f..a69cfab 100644
--- a/main.py
+++ b/main.py
@@ -87,6 +87,7 @@ if __name__ == "__main__":
# NOTE: parser output is shown via message box
# we also need a dummy invisible window for the parser
root = tk.Tk()
+ root.tk.call("tk", "scaling", 2.0)
root.overrideredirect(True)
root.withdraw()
set_root_icon(root, resource_path("icons/pickaxe.ico")) The result does not look great (everything still looks blurry, and I had to maximize the window so it would fit into my non-HiDPI screen):
It'd be great if you could. This HiDPI territory is new to me. In any case, let me know if/when you can, this is not high priority by any means. |
Maybe I wasn't exactly clear in my original response about this, but as far as I understand it, The end result should look akin of what the https://stackoverflow.com/a/74105119 shows in it's test and pictures, with window #1 showing the
That's good then. They'll require scaling just like any other GUI element anyway though.
As far I understand it, the description refers to HiDPI displays, and the calculations are done solely to maintain the same physical size of any graphical object (font size for ex.) between a normal and HiDPI monitor. This needs to be taken care of separately from Windows GUI scale. For a normal monitor and the Windows GUI scale only, you're supposed to the scale factor to whatever the scaling factor is currently set in Windows, so for 150% scale, the factor should be I'm still yet to test everything on my side, but this is more or less a backburner issue for now. I'll need to start doing tests myself to push it anywhere. |
I'm not sure if this is the best place to do this (or even the correct way to do this), but this does fix blurry fonts on Windows on displays with scaling factors higher than 100%.
Before (125% scaling factor):
After (125% scaling factor):