Open In App

turtle.up() method in Python

Last Updated : 16 Jul, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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.up()

The turtle.up() method is used to pull the pen up from the screen. It gives no drawing on moving to another position or direction. 

turtle.up() or turtle.pu() or turtle.penup()

Here, this method can be called with three names as written above i.e; it has Aliases: penup | pu | up. There is no argument required for this method.

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

Example 1 :

Python3




# import package
import turtle
  
  
# forward the turtle (drawing)
turtle.forward(50)
  
# up the turtle
turtle.up()
  
# forward the turtle (no drawing)
turtle.forward(50)
  
# down the turtle
turtle.down()
  
# forward the turtle (drawing)
turtle.forward(50)


Output:

Example 2 :

Python3




# import package
import turtle
  
  
# forward the turtle (drawing)
turtle.forward(50)
  
# turn right 90 degrees
turtle.right(90)
  
# up the turtle
turtle.up()
  
# forward the turtle (no drawing)
turtle.forward(50)
  
# down the turtle
turtle.down()
  
# turn right 90 degrees
turtle.right(90)
  
# forward the turtle (drawing)
turtle.forward(50)


Output:



Next Article

Similar Reads

Article Tags :
Practice Tags :
three90RightbarBannerImg
  翻译: