I'm working with python's turtle module and want to load different fonts. I've read that turtle uses tkinter's fonts but some of these fonts that should be available are in fact not. Does anyone know how I can add fonts or get a list of available ones? I would especially like to write arabic, hebrew fonts.
CodePudding user response:
Try this to list fonts.
import tkinter as tk
r = tk.Tk()
print(list(tk.font.families()))
Turtle is based on tkinter
, so you list the tkinter
fonts.
CodePudding user response:
To add a font, first download the font you want and install it on your system.
Then you can use this font in your code as shown in the example.
from turtle import Screen, Turtle
screen = Screen()
turtle = Turtle()
turtle.write("Pacifico Font", align='center', font=('Pacifico', 48))
screen.mainloop()
I hope it helps you about adding a new font.
Reference: How can I use custom local fonts in Python Turtle?
Also, you can check this out too.