To write text with the Python turtle module, you can use the Python turtle write() function and pass the font parameter a font name, font size and font type.
import turtle
t = turtle.Turtle()
t.write("Hello", font=("Arial", 12, "normal")
The turtle module in Python allows us to create graphics easily in our Python code.
We can use the turtle module to write text to the turtle canvas with the write() function.
The Python turtle write() function takes a parameter called font and with this parameter, you can change the font you write with your turtle.
Below is an example of how you can use the font parameter to write with turtle in Python.
import turtle
t = turtle.Turtle()
t.write("Hello", font=("Arial", 12, "normal"))
How to Change Font Color of Turtle write() Function in Python
By default, the font color for your turtle is black.
You can change the color of your turtle using the turtle color() function. You can use any valid Tk color name with turtle module, as well as RGB colors.
Below shows you an example of how you can change the font color when using the turtle module in Python.
import turtle
t = turtle.Turtle()
t.color("blue")
t.write("Hello", font=("Times New Roman", 24, "bold"))
List of Turtle Fonts for Turtle write() Function in Python
With the turtle module, we can use a number of different fonts. The fonts you can use with the turtle module are all of the many symbolic font names that Tk recognizes.
The list is hundreds of fonts long, but below are a handful of common fonts you can use with turtle.
fonts = ["Helvetica", "Arial", "Times New Roman", "Calibri", "Courier", "Verdana"]
To change the font for your turtle, just pass the font name you want to use.
Below is an example of how you can use the font parameter to write with different fonts with turtle in Python.
import turtle
t = turtle.Turtle()
t.color("green")
t.write("Hello", font=("Calibri", 16, "normal"))
Hopefully this article has been useful for you to learn how you can change the fonts for your turtle in Python.