turtle.stamp() function in Python
Last Updated :
11 Jun, 2021
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.stamp()
This method is used to stamp a copy of the turtleshape onto the canvas and return its id. It doesn’t require any argument. Whatever the shape of the turtle is, it is printed at that point and continues with the next instructions.
turtle.stamp()
Below is the implementation of the above method with some examples :
Example 1:
Python3
import turtle
turtle.forward( 100 )
turtle.stamp()
turtle.forward( 100 )
|
Output:
Here the middle one arrow is due to the stamp and next is turtle’s head
Example 2:
Python3
import turtle
for i in range ( 15 ):
turtle.forward( 100 + 10 * i)
turtle.stamp()
turtle.right( 90 )
|
Output :
Printing the turtle’s shape at each movement
Share your thoughts in the comments
Please Login to comment...