I am trying to create a Tkinter application that uses a custom font from Google Fonts. Here is the link to the font I am using: Font Page. I have searched online for a way to change the font in Tkinter, but none of the solutions I found seem to work. Below is the most reasonable and understandable code I have found so far, but it does not seem to apply the custom font correctly.
import pyglet,tkinter
pyglet.font.add_file(r"C:UsersWillDownloadsExan-Regular.ttf")
root = tkinter.Tk()
MyLabel = tkinter.Label(root,text="test",font=('Exan-Regular',25))
MyLabel.pack()
root.mainloop()
I have also tried using ChatGPT for help, but it couldn’t provide a solution. Additionally, I have looked at several Stack Overflow posts, like this one, but they haven’t resolved my issue either.
Can anyone help me understand what might be going wrong or provide a working example of how to use a custom Google Font in a Tkinter application?
Thank you!