Draw moving object using Turtle in Python

Prerequisite: Python Turtle Basics

Turtle is an inbuilt module in python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle. To move turtle, there are some functions i.e forward(), backward(), etc.

Move the Object (ball)  :

Following steps are used:

  • Import Turtle package.
  • Set screen with dimensions and color.
  • Form turtle object with color.
  • Form the object (ball – made of colored circle).
  • Call the function for making object again and again and clear the screen.

Below is the implementation  :






# import turtle package
import turtle
# function for movement of an object 
def moving_object(move):
    # to fill the color in ball
    # start color filling
    # draw circle
    # end color filling
# Driver Code
if __name__ == "__main__" :
    # create a screen object
    screen = turtle.Screen() 
    # set screen size
    # screen background color
    # screen updaion 
    # create a turtle object object
    move = turtle.Turtle() 
    # set a turtle object color
    # set turtle object speed
    # set turtle object width
    # hide turtle object
    # turtle object in air
    # set initial position
    move.goto(-250, 0
    # move turtle object to surface
    # infinite loop
    while True :
        # clear turtle work
        # call function to draw ball
        # update screen
        # forward motion by turtle object


Output :

moving object in turtle

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.