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

Scaling issues with HighDPI #18

Open
lorisobi opened this issue Feb 3, 2022 · 5 comments
Open

Scaling issues with HighDPI #18

lorisobi opened this issue Feb 3, 2022 · 5 comments
Labels

Comments

@lorisobi
Copy link

lorisobi commented Feb 3, 2022

grafik

Problems with all elements:

  • switch, checkboxes and radio buttons do not scale at all
  • border radius of textboxes and buttons do not scale
  • treeview height does not scale
  • progress bar and scale does not scale
@rdbende
Copy link
Owner

rdbende commented Feb 3, 2022

Hi, could you check if you are experiencing this problem with the svg based theme? (you will need to install tksvg to use it) (note to self: we'll need to scale up the images before rasterizing when using the svg version).
I've never experimented with high resolution displays with Tkinter, so I don't know, what the solution could be, but I'll play around with it if I have time.

@lorisobi
Copy link
Author

lorisobi commented Feb 4, 2022

grafik
it seems to be the same with the svg version

but the scaling issue with some of the elements even exist without your theme, so it's probably something with tkinter itself
grafik

anyhow your theme is really good work, finally a way to make python gui apps beautiful

@rdbende rdbende pinned this issue Feb 21, 2022
@rdbende rdbende changed the title problems with tk scale (on 4k hdpi) Scaling issues with HighDPI Apr 23, 2022
@rdbende rdbende added the HiDPI label Sep 12, 2022
@rdbende
Copy link
Owner

rdbende commented Mar 18, 2023

Also breaks with low-DPI:
image

@rdbende rdbende mentioned this issue Mar 18, 2023
@AlanCristhian
Copy link

Add the following lines on you main app.

import sys

if sys.platform == "win32":
    try:
        import ctypes
        PROCESS_SYSTEM_DPI_AWARE = 1
        shcore = ctypes.OleDLL("shcore")
        shcore.SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
    except (ImportError, AttributeError, OSError):
        pass

Does this solve your problem?

@rdbende
Copy link
Owner

rdbende commented May 31, 2023

In #76 they say, that using ctypes.windll.shcore.SetProcessDpiAwareness(True) fixes some things, but makes the scaling super weird.

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

No branches or pull requests

3 participants