0

I want to use a download font in Tkinter for my Python project, I read a few answers on another post but my pyglet module won't work, is there an alternative way to use my font

1 Answers1

0

This worked for me (with Pycharm's pyglet library) and can be used to add downloaded fonts to Tkinter (but once again your platform must support the pyglet module):

import tkinter as tk
import pyglet

# replace 'font.ttf' with your ttf file 
pyglet.font.add_file('font.ttf')

root = tk.Tk()

# replace 'font' with your font name
MyLabel = tk.Label(root, text="font test", font=('font', 15))

MyLabel.pack()
root.mainloop()
Jai Amin
  • 16
  • 4