我想更改字体系列,但它不起作用。Tkinter不更改字体系列
from tkinter import *
import tkinter.font as font
class Window:
def __init__(self):
root = Tk()
def_font=font.Font(family='Times')
root.title("Serial Conection Program")
self.mainFrame= Frame(root)
self.portLabel=Label(self.mainFrame, text="Port: ",font= def_font)
....
....
我试图像正常font= 'Times'
,但是这也没有工作...
也许有些问题的解释(我使用Python 3.6.1-anaconda3)?
There is an image(I tried to change font in label "connection" to family "Times"
你怎么知道它不工作?你有错误吗? –
此代码不会生成错误,但不会更改(仅可更改大小)。 –
基于该截图,它看起来像tkinter没有在您的系统上找到任何字体,并且正在回落到位图字体。在创建字体后将以下代码行添加到程序中时,您会得到什么? '打印(def_font.actual())' –