[other] 我使用Python Tkinter开发UI,为什么字体看不清楚?
Tofloor
poster avatar
bing
deepin
2023-06-25 01:02
Author

我使用Python Tkinter开发UI,为什么字体看不清楚?
image.png

Reply Favorite View the author
All Replies
阿尼樱奈奈
Moderator
2023-06-25 01:12
#1

星火商店安装Win字体试试。

Reply View the author
青稚°
Moderator
2023-06-25 01:17
#2

下载星火应用商店,安装windows字体集。

Reply View the author
bing
deepin
2023-06-25 02:56
#3
青稚°

下载星火应用商店,安装windows字体集。

都安装了,还是一样。

image.png

Reply View the author
wlly-lzh
deepin
2023-06-25 03:20
#4

有没有可能是你的字体设置的问题?

你修改一下代码里面设置的字体试试。

Reply View the author
神末shenmo
deepin
Spark-App
2023-06-25 03:26
#5

换pyqt吧

Reply View the author
berners
deepin
Backbone of ecological co-construction group
2023-06-25 04:58
#6

你设置为别的字体试试看,有可能你的是点阵字体,不是矢量字体,导致的这个现象.

例如,如果你想将一个标签的字体设置为“华文楷体”,你可以这样写:

import tkinter as tk
from tkinter import font

root = tk.Tk()
my_font = font.Font(family="华文楷体", size=20)
my_label = tk.Label(root, text="这是一个标签", font=my_font)
my_label.pack()
root.mainloop()

不排除是程序的dpi有问题,

Linux 系统下:

还在查找😢


这个是windows系统下的:

ctypes.windll.shcore.SetProcessDpiAwareness(2)函数看看。例如:

import tkinter as tk
import ctypes

ctypes.windll.shcore.SetProcessDpiAwareness(2)

root = tk.Tk()
my_label = tk.Label(root, text="这是一个标签")
my_label.pack()
root.mainloop()
Reply View the author
晚秋(lateautumn)
Moderator
2023-06-25 17:54
#7
神末shenmo

换pyqt吧

神末:PYQT从哪下载,从软件商店与星火商店都没找到confused

Reply View the author
berners
deepin
Backbone of ecological co-construction group
2023-06-25 18:36
#8
晚秋(lateautumn)

神末:PYQT从哪下载,从软件商店与星火商店都没找到confused

sudo apt-get install python3-pyqt5

Reply View the author
晚秋(lateautumn)
Moderator
2023-06-25 22:09
#9
berners

sudo apt-get install python3-pyqt5

好的,谢谢,上午从神末的星火上装了pycham专业版,而且也成功激活了。like

Reply View the author
berners
deepin
Backbone of ecological co-construction group
2023-06-25 22:53
#10
晚秋(lateautumn)

好的,谢谢,上午从神末的星火上装了pycham专业版,而且也成功激活了。like

你激活的是正版码?

Reply View the author
晚秋(lateautumn)
Moderator
2023-06-25 23:26
#11
berners

你激活的是正版码?

专业版
image.png

Reply View the author