Turtle Graphics

 Turtle graphics is a means of controlling a graphical entity (a "turtle") in a graphics window using x,y coordinates. Python provides the capability of turtle graphics through the turtle Python standard library module.

Advantages of Turtle Graphics

  1. Enhancing understanding of objects in programming.
  2. Providing an enjoyable and creative aspect to programming.

Creating a Turtle Graphics Window

The first step in using turtle graphics is to create a turtle graphics window, also known as a "turtle screen".

  • Begin by importing the turtle module
  • Each turtle graphics method should be called in the form turtle.methodname.
  • To create a turtle screen, we use the turtle.Screen() method.
  • The setup() method is then used to specify the size of the window in pixels. The center point of the window is at coordinate (0,0).
  • For example, turtle.setup(800, 600) creates a window that is 800 pixels wide and 600 pixels high.
  • The background color of the turtle window can be changed from the default white background color using the bgcolor() method.