我已经在我的计算机上安装了一个新字体,并且也安装在我的计算机上。 现在,我使用tkinter库在Python代码中使用它,但它不起作用。在
self.master = master
self.my_font = tkinter.font.Font(self.master, family="My Girl Is Retro Regular")
self.master.grid_rowconfigure(0, weight=2)
self.master.grid_columnconfigure(0, weight=1)
self.playPhoto = PhotoImage(file='toppic.png')
self.toppic = Label(self.master,image=self.playPhoto)
self.toppic.grid(pady=(0,50))
self.youtubeLinkLabel = Label(self.master, text="Paste the YouTube Link Below: ", font=("My Girl Is Retro Regular", 30),fg='red')
self.youtubeLinkLabel.grid(pady=(0,20))
self.youtubeEntryVar = StringVar()
self.youtubeEntry = Entry(self.master, width=70, textvariable=self.youtubeEntryVar,font=("Agency FB", 25),fg='green')
self.youtubeEntry.grid(pady=(0, 15),ipady=10)
self.youtubeEntryError = Label(self.master, text="", font=("Concert One", 20))
self.youtubeEntryError.grid(pady=(0, 8))
# Asking where to save file label
self.youtubeFileLocationLabel = Label(self.master, text="Choose Directory: ",font=("My Girl Is Retro Regular", 60))
self.youtubeFileLocationLabel.grid()
self.youtubeFileLocationEntry = Button(self.master, text="Directory", command=self.openDirectory)
self.youtubeFileLocationEntry.grid(pady=(10, 3))
# Entry label if user don`t choose directory
# openDirectory func
self.fileLocationLabelError = Label(self.master, text="", font=("My Girl Is Retro Regular", 20))
self.fileLocationLabelError.grid()
# What to download MP3 or MP4 label
self.youtubeChooseLabel = Label(self.master, text="Please choose what to download: ",
font=("My Girl Is Retro Regular", 30))
self.youtubeChooseLabel.grid()
我已经在谷歌上搜索过了,但找不到
您调用的字体名称不正确,您会注意到它产生了意外的字体。如果您在windows上,打开
ttf
文件,名称就会在那里。以下是截图:在上面的屏幕截图中,字体名是
Alien League
。您可以尝试将My Girl Is Retro Regular
替换为Comic Sans MS
,这是一种内置的Windows字体。它会起作用的。我找到了你使用的字体的正确名称。它的
My Girl Is Retro
。在相关问题 更多 >
编程相关推荐