Python Turtle Font

In this Python tutorial, we will learn How to select Font in Python Turtle and we will also cover different examples related to Python Turtle Font. And, we will cover these topics.

  • Python turtle font
  • Python turtle font Size
  • Python turtle font Style
  • Python turtle font Color
  • Python turtle font List
  • Python turtle font example

Python turtle font

In this section, we will learn about how to select font in Python turtle.

The font is used for changing the size, style, color which give an attractive look to the text.

Code:

In the following code, we import the turtle library from turtle import *, import turtle, and also write a text with help of the write() function inside the write() function we use font=(” Verdana “) to give an attractive look to the text.

from turtle import *

import turtle
 
turtle.write("Python Guides", font=("Verdana"))
turtle.done()

Output:

After running the above code we get the following output in which we see the text is written on the screen with the beautiful font.

Python turtle font
Python turtle font Output

Python turtle font Size

In this section, we will learn how to select and change the font size in Python turtle.

Font Size is defined to give a size to our font that depends upon a document if it is a heading we give a large font size and writing inside a paragraph we give a small size to our text.

Code:

In the following code, we import the turtle library import turtle and also write a text with help of the write() function inside the write() function we use font=(‘arial’, 50, ‘bold’) to give a size to the text.

import turtle

turtle.write('Hello!', font=('arial',50,'bold'), align='center')
turtle.hideturtle()
turtle.exitonclick()

Output:

After Running the above code we get the following output where we can see how with the help of the write() function we give a size to our font.

Python turtle font size
Python turtle font size Output

Python turtle font Style

In this section, we will learn about how to give turtle font style in Python turtle.

Font style is used for giving the style to our text or heading to any title which makes a document attractive and presentable.

Code:

In the following code, we are giving a style to our font where we define Style= (‘Courier’, 60, ‘italic’), and with help of the write() function, we are calling style inside a font.

from turtle import *
import turtle

turtle.color('cyan')
Style = ('Courier', 60, 'italic')
turtle.write('Python Guides!', font=Style, align='center')
turtle.hideturtle()
turtle.done()

Output:

After running the above code we have the following output where we gave a style to our font.

Python turtle font style
Python turtle font style

Python turtle font Color

In this section, we will learn about turtle font color in Python turtle.

Font color gives color to text or heading that looks our screen colorful and attractive. We can choose any font color for the text that we want.

Code:

In the following code, we give color to our text that gives an attractive look to the document.

fontcolor=tur.color(‘purple’) is used for giving the color to the text.

from turtle import *
import turtle

tur = turtle.Turtle()
fontcolor=tur.color('purple')

tur.write("Python Guides", font=("Calibri",20, "bold"))
tur.hideturtle()
turtle.done()

Output:

After running the above code we get the following output in which we see the colored text is shown on the screen which looks beautiful.

Python turtle font color
Python turtle font color Output

Python turtle font List

In this section, we will learn about how to create a font list in Python turtle.

A font list is used to assign the text in a list form where text can be listed from top to bottom and also according to text size.

Code:

In the following code, we create a list where text is assigned in the list form where text is visible from small to large which changes the size of the font as per the heading inside a list.

  • list.speed(1) is used to give slow speed to the turtle.
  • list.penup() is used for stop drawing of the turtle pen.
  • list.goto(0,200) is used to move the turtle to an absolute position.
  • list.color(“purple”) is used to give the color to the text.
from turtle import *
import turtle

list=turtle.Turtle()
list.speed(1)

list.penup()
list.goto(0,200)

list.color("blue")
list.write("Python Guides!",font=("arial",20,"bold"),align="center")

list.penup()
list.goto(0,150)

list.color("purple")
list.write("Python Guides!",font=("Time New Roman",30,"italic"),align="center")

list.penup()
list.goto(0,80)

list.color("cyan")
list.write("Python Guides!",font=("Apple Chancery",50,"underline"),align="center")

list.hideturtle()
turtle.exitonclick()

Output:

After running the above code we get the following out in which we can see the list in which the text is assigned which gives the attractive look to the screen.

Python turtle font list
Python turtle font list Output
  • Draw colored filled shapes using Python Turtle

Python turtle font example

In this section, we will learn about turtle font examples in Python turtle.

As we know font is used for changing the size, style, and color of the text. After applying any of the fonts our text looks pretty and attracts the user’s eye.

Code:

In the following code, we are giving style, color, size to text from which our document looks attractive and presentable.

  • tur.color(‘violet’) is used to give the color to text.
  • tur.write(‘Hello Guides!’, font=style, align=’center’) is used to write the text and also give style to text.
from turtle import *
import turtle as tur

tur.color('violet')
style = ('Arial', 30, 'bold')
tur.write('Hello Guides!', font=style, align='center')
tur.hideturtle()
tur.done()

Output:

After running the above code we get the following output in which we can see the text is written with different style, size, and color.

Python turtle font example
Python turtle font example Output

You may like the following Python turtle tutorials:

So, in this tutorial, we discussed Python Turtle Font and we have also covered different examples related to its implementation. Here is the list of examples that we have covered.

  • Python turtle font
  • Python turtle font Size
  • Python turtle font Style
  • Python turtle font Color
  • Python turtle font List
  • Python turtle font example