turtle.getpen() function in Python
Last Updated :
23 Jul, 2020
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.getpen()
This function is used to return the Turtleobject itself. It doesn’t require any argument.
Syntax :
turtle.getpen()
Below is the implementation of the above method with some examples :
Example 1 :
Python3
import turtle
turt = turtle.getpen()
print (turt)
|
Output :
<__main__.Turtle object>
Example 2 :
Python3
import turtle
turt = turtle.getpen()
turt.width( 5 )
turt.color( "blue" )
turt.shape( "turtle" )
turt.forward( 150 )
|
Output :
Share your thoughts in the comments
Please Login to comment...