In this article we will learn how to Make an Octagon using Turtle Graphics in Python. For that lets first know what is Turtle Graphics.
- backward(length): moves the pen in the backward direction by x unit.
- right(angle): rotate the pen in the clockwise direction by an angle x.
- left(angle): rotate the pen in the anticlockwise direction by an angle x.
- penup(): stop drawing of the turtle pen.
- pendown(): start drawing of the turtle pen.
- import the turtle modules.
- Get a screen to draw on
- Define an instance for turtle.
- For a drawing an Octagon execute a loop 8 times.
- In every iteration move turtle 100 units forward and move it left 45 degrees( corresponding to 135 degrees between two sides, so 180-135=45 degrees).
- This will make up an angle 135 degree between 2 sides.
- 8 iterations will make up an Octagon perfectly.
Below is the Python implementation of the above approach:
- Draw Shape inside Shape in Python Using Turtle
- Python - Draw "GFG" logo using Turtle Graphics
- Python - Draw Hexagon Using Turtle Graphics
- Python - Draw Star Using Turtle Graphics
- Draw Rainbow using Turtle Graphics in Python
- Draw Heart Using Turtle Graphics in Python
- Draw Panda Using Turtle Graphics in Python
- turtle.shape() function in Python
- Python | Draw rectangular shape and extract objects using OpenCV
- Draw a Tic Tac Toe Board using Python-Turtle
- Draw Circle in Python using Turtle
- Draw any polygon in Turtle - Python
- Draw Ellipse Using Turtle in Python
- Draw Dot Patterns Using Turtle in Python
- Python - Write "GFG" using Turtle Graphics
- Draw Square and Rectangle in Turtle - Python
- Draw Spiraling Star using Turtle in Python
- Draw Chess Board Using Turtle in Python
- Draw Graph Grid Using Turtle in Python
- Draw moving object using Turtle in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.