turtle.mode() function in Python
Last Updated :
19 Dec, 2023
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.mode()
This function is used to set turtle-mode (‘standard’, ‘logo’ or ‘world’) and perform reset.
Syntax : turtle.mode(mode=None)
Parameter:
mode: one of the strings ‘standard’, ‘logo’ or ‘world’
- Mode ‘standard’ is compatible with turtle.py.
- Mode ‘logo’ is compatible with most Logo-Turtle-Graphics.
- Mode ‘world’ uses userdefined ‘worldcoordinates’.
Below is the implementation of the above method with some examples :
Example 1 :
Python3
import turtle
print (turtle.mode())
|
Output :
standard
Example 2 :
Python3
import turtle
turtle.forward( 180 )
turtle.mode(mode = 'logo' )
turtle.forward( 120 )
turtle.mode(mode = 'world' )
turtle.forward( 100 )
turtle.setworldcoordinates( - 500 , - 500 , 500 , 500 )
|
Output :
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...