alejandroautalan / pygubu-designer

A simple GUI designer for the python tkinter module
GNU General Public License v3.0
824 stars 101 forks source link

Add supporting for the screen of high dpi #242

Closed chenyulue closed 6 months ago

chenyulue commented 7 months ago

Firstly, thanks for the awesome designer!

I use Win11, and the screen is of high dpi (2560 x 1600 pixels). I have set the screen scale to 150%. However, pygubu-designer seems not to support the screen of high dpi.

The size of labels in the UI are too small, and the menus overlap, as the following shows.

Are there any plans to add supporting for the screen of high dpi?

2024-03-14_203554

alejandroautalan commented 7 months ago

Hello @chenyulue, thanks for trying pygubu.

I managed to recreate the problem. I will try to find a solution as soon as possible.

Regards Alejandro A.

MozisII commented 7 months ago

Hi, I resolved this issue by patching start of main.py starting line 56 (just after import section):

_# Initialize logger
logger = logging.getLogger(__name__)

# translator function
_ = translator

import ctypes
try: # >= win 8.1
    ctypes.windll.shcore.SetProcessDpiAwareness(2)
except: # win 8.0 or less
    try: 
        ctypes.windll.user32.SetProcessDPIAware()
    except: # Linux and so
        pass

def init_pygubu_widgets():

    # Initialize all builders from plugins
    all_modules = []_

Regards Sylvain

chenyulue commented 7 months ago

It solves the problem. Thanks! @MozisII

alejandroautalan commented 6 months ago

High dpi support implemented for Windows OS. Fixed in version 0.39