Tuesday, November 19, 2024
Google search engine
HomeLanguagesturtle.getpen() function in Python

turtle.getpen() 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.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 package
import turtle
  
  
# get turtle object
# and store it 
turt=turtle.getpen()
  
# print turtle object
print(turt)


Output :

<__main__.Turtle object>

Example 2 :

Python3




# import package
import turtle
  
  
# get turtle object
# and store it 
turt=turtle.getpen()
  
# use it for turtle methods
turt.width(5)
turt.color("blue")
turt.shape("turtle")
turt.forward(150)


Output :

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments