如何设置Windows的"DPI缩放替代".通过脚本? [英] How can I set Windows "DPI-scaling overrides" via a script?

查看:800
本文介绍了如何设置Windows的"DPI缩放替代".通过脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个基于Python的应用程序,带有为多个操作系统创建的WxPython GUI.在Windows 10中,至少在我的环境中(高分辨率监视器上的VM内),界面中的文本元素模糊.我可以通过设置Windows应用程序

We have a Python-based application with a WxPython GUI that we create for multiple operating systems. 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 appearance by setting the Windows application DPI-scaling override. However, the only way I have found so far is to do it manually from the Windows file explorer interface.

我的问题:是否可以通过命令行设置此属性,以便在构建应用程序时可以对此进行脚本编写?

My question: Is there a way to set this property from the command line, so that I can script this as part of building our application?

推荐答案

在python代码中:

in python code:

ctypes.windll.shcore.SetProcessDpiAwareness(1)

https://docs.microsoft .com/zh-CN/windows/desktop/api/shellscalingapi/nf-shellscalingapi-setprocessdpiawareness

这篇关于如何设置Windows的"DPI缩放替代".通过脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆