Skip to content
Related Articles

Related Articles

Improve Article

turtle.write() function in Python

  • Difficulty Level : Easy
  • Last Updated : 16 Feb, 2021
Geek Week

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.write()

This function is used to write text at the current turtle position. 

Syntax :

turtle.write(arg, move=False, align=’left’, font=(‘Arial’, 8, ‘normal’)) 
 

Parameters:



Arguments               Description                                                                                 
argInfo, which is to be written to the TurtleScreen
moveTrue/False
alignOne of the strings “left”, “center” or right”
fontA tuple (fontname, fontsize, fonttype)

Below is the implementation of the above method with some examples :

Example 1 :

Python3




# import package
import turtle
 
# write text
turtle.write("GeeksForGeeks")

 
 

Output :

 

 



Example 2 :

 

Python3




# import package
import turtle
 
# write text
# move turtle
turtle.write("GeeksForGeeks", move=True)

Output :

Example 3 :

Python3




# import package
import turtle
 
# write text
# styling font
turtle.write("GeeksForGeeks", font=("Verdana",
                                    15, "normal"))

Output :

Example 4 :



Python3




# import package
import turtle
 
# write text
# align at right
turtle.write("GeeksForGeeks", align="right")

 
 

Output :

 

 

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :