【问题标题】:How to fix blurry text in WxPython controls on Windows?如何修复 Windows 上 WxPython 控件中的模糊文本?
【发布时间】:2018-06-16 01:26:19
【问题描述】:

我们有一个使用 WxPython 4 编写的基于 Python 的应用程序,我们为包括 Windows 在内的多种操作系统构建。在 Windows 10 中,至少在我的环境中(在高分辨率监视器上的 VM 内),界面中的文本元素是模糊的:

我可以通过应用程序上的setting the Windows DPI-scaling override 来稍微改善这种情况。这是间接的和次优的,似乎应该有一种方法可以更直接地从 WxPython 中做到这一点。但是,我还没有找到方法。

有什么方法可以从 WxPython 设置 DPI 缩放,或者直接从应用程序中在 WxPython 4 中修复 Windows 上的模糊文本?

【问题讨论】:

    标签: windows python-3.x wxpython dpi


    【解决方案1】:

    根据a message from Python Issue Tracker 和我在the wxPython official Hello World, Part 2 example (helloworld2.py) 中的尝试,将以下代码添加到您的程序应该可以工作:

    import ctypes
    try:
        ctypes.windll.shcore.SetProcessDpiAwareness(True)
    except:
        pass
    

    【讨论】:

      猜你喜欢
      • 2014-12-04
      • 1970-01-01
      • 2012-08-04
      • 2013-03-17
      • 2011-05-09
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多