Monday, September 23, 2024
Google search engine
HomeLanguagesturtle.getscreen() function in Python

turtle.getscreen() 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.getscreen()

This function is used to Return the TurtleScreen object, the turtle is drawing on.  It doesn’t require any argument. So TurtleScreen-methods can be called for that object.

Syntax :

turtle.getscreen()

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

Example 1 :

Python3




# import package
import turtle
  
  
# get turtle screen object
# and store it 
sc=turtle.getscreen()
  
# print the turtle screen object
print(sc)


Output :

<__main__.Screen object>

Example 2 :

Python3




# import package
import turtle
  
  
# get turtle screen object
# and store it 
sc=turtle.getscreen()
  
# use it for turtle screen methods
sc.setup(400,400)
sc.bgcolor("blue")


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