We have a Python-based application written with WxPython 4 that we build for multiple operating systems, including Windows. In Windows 10, at least in my environment (inside a VM on a high resolution monitor), the text elements in the interface are blurry:
I can improve the situation somewhat by setting the Windows DPI-scaling override on the application. This is indirect and suboptimal, and it seems like there should be a way to do it from WxPython more directly. However, I have not found a way to do it.
Is there any way to set DPI scaling from WxPython, or otherwise fix blurry text on Windows in WxPython 4 directly from within the application?
According to a message from Python Issue Tracker and what I tried in the wxPython official Hello World, Part 2 example (helloworld2.py), adding following code to your program should work:
import ctypes
try:
ctypes.windll.shcore.SetProcessDpiAwareness(True)
except:
pass