Python tkinter字体不改

Python tkinter font do not change

我无法更改标签的字体。

from tkinter import *

nc = Tk()

#LABEL cognome
cognome_l=Label(nc, text="cognome", 
        font=('Ubuntu 20'))
cognome_l.grid(row=0,column=0,sticky='E',padx=5, pady=5)

#LABEL cognome
cognome_l=Label(nc, text="cognome", 
        font=('Verdana 20'))
cognome_l.grid(row=1,column=0,sticky='E',padx=5, pady=5)


nc.mainloop()

这两个标签应该不同,但它们是一样的,而且文字看起来很模糊。 我该如何解决? 谢谢

编辑: 这就是我得到的: https://drive.google.com/file/d/1UcIqr5itZhrTMkspytwbPmLTiQwbhnga/view?usp=sharing

你应该写 font = ('Verdana', 20) 尽管 font = ('Verdana 20')

cognome_l = Label(nc, text="cognome", font="Times 15")

您需要为这样的字体指定 属性:

"fontname fontsize"

"Courier 14"

已编辑

我使用带有 python 解释器的 sublime text 执行了你的程序代码。我的电脑上安装了 Verdana 字体,但没有安装 Ubuntu 字体。

Verdana 在 Microsoft Word 和 Python 上的结果几乎相同。 我没有 Ubuntu 字体,这就是为什么它向我显示 python 中的默认字体。 所以我想你可能没有安装 Verdana 和 Ubuntu 字体。

问题是我用的是conda环境