Open In App

turtle.reset() function in Python

Last Updated : 28 Jul, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

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.reset()

This function is used to delete the turtle's drawings and restore its default values. It doesn't require any argument.

Syntax :

turtle.reset()

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

Example 1 :

Python3
# import package
import turtle

# motion
for i in range(20):
    turtle.forward(2+2*i)
    turtle.left(45)
    
# reset the work
turtle.reset()

Output :

 

Example 2 :

Python3
# import package
import turtle

# make turtle objects
# and set position
t1 = turtle.Turtle()
t2 = turtle.Turtle()
t1.up()
t1.setpos(-70, 0)
t1.down()
t2.up()
t2.setpos(70, 0)
t2.down()

# loop for pattern
for i in range(20):
    t1.forward(2+2*i)
    t1.left(45)
    t2.forward(2+2*i)
    t2.left(90)

# reset first turtle
# another remain as it is
t1.reset()

Output :


Article Tags :
Practice Tags :

Similar Reads

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy