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 :