gpt4 book ai didi

python-2.7 - 图标和文本 Python 2.7 的 Tkinter 输出模糊

转载 作者:行者123 更新时间:2023-12-04 00:10:30 36 4
gpt4 key购买 nike

我已经在网上搜索过了,似乎找不到满意的答案。每当我运行具有 Tkinter GUI 的程序时,它总是看起来模糊/模糊(我认为这是低分辨率)。它的分辨率似乎比我运行这些程序的几台计算机上运行的 Windows 10 操作系统低得多。

无论我运行什么程序,对于所有类型的 Tkinter 实体(例如按钮、标签、文件对话框等),我仍然会得到相同的结果。这就是为什么我没有包含代码示例的原因。

下面我复制了一些例子:

Tkinter FD

Tkinter Label

这是我应该预料到的,还是我需要更改 OS\Python\Tkinter 上的一些设置。

非常感谢任何帮助。

最佳答案

这似乎是对操作系统的调整。我不知道细节(很高兴得到解释),但它可以在 Windows 10 上完成工作:

ctypes.windll.shcore.SetProcessDpiAwareness(1)

在启动 GUI 之前调用它,即:

import ctypes
.
.
.
if __name__ == "__main__":
if 'win' in sys.platform:
ctypes.windll.shcore.SetProcessDpiAwareness(1)

[call your Tkinter stuff]

从这里得到它:

Attempting to resolve blurred tkinter text + scaling on Windows 10 high DPI displays, but concerned my approach is not Pythonic or is unsafe

关于python-2.7 - 图标和文本 Python 2.7 的 Tkinter 输出模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36514158/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com