turtle.write() function in Python

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                                                                                 
arg Info, which is to be written to the TurtleScreen
move True/False
align One of the strings “left”, “center” or right”
font a triple (fontname, fontsize, fonttype)

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

Example 1 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

Example 2 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :



Example 3 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

Example 4 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.