[英]Unable to change font size in Python/tkinter
I tried to change fontsize in the python but it doesn't change at all no matter value of the fontsize我尝试更改 python 中的字体大小,但无论字体大小的值如何,它都不会改变
My code:我的代码:
import tkinter
window = tkinter.Tk()
window.title("My First GUI Program")
window.minsize(width=600, height=300)
#Label
my_label = tkinter.Label(text="I am a label", font=("Arial", 24, "bold"))
my_label.pack()
window.mainloop()
Can anyone have any solution to fix this?任何人都可以有任何解决方案来解决这个问题吗? I checked that the "Arial" font already installed on my system
我检查了我的系统上是否已经安装了“Arial”字体
Assuming you're on windows, you can go to C:\Windows\Fonts
and find Arial.ttf
and copy it to your project directory.假设您在 windows 上,您可以 go 到
C:\Windows\Fonts
并找到Arial.ttf
并将其复制到您的目录。 I had this same problem a while back and this fixed it.不久前我遇到了同样的问题,这解决了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.