Python tkinter- Conpensate Windows Display Scaling

Viewed 27

My program has a fixed resolution main window, i dont want it to be resizable, but some PCs with very small monitors will have high display scalling setting, so the program cannot show the full window, is there a way to extract this scaling factor so i can conpensate that? Or is there a way to compile the exe so that it does not scale according to the settings?

1 Answers

If I understood you correctly, the answer for your problem is below:


fixedWidth = 1920
fixedHeight = 1080

user_monitor = get_monitors()
scale = user_monitor.width / fixedWidth

if user_monitor.widht < fixedWidth:
    fixedWidth = user_monitor.width
if user_monitor.height < fixedHeight:
    fixedHeight = user_monitor.height

and of course you have to multiply by scale the rest of you program sizes to scale down your program

Related