Turtle library enables users to draw pictures or shapes using commands, providing them with a virtual canvas. turtle comes with Python’s Standard Library. It needs a version of Python with Tk support, as it uses tkinter for the graphics. In this article, we will generate a circular pattern out of squares using Python’s turtle module.
For drawing the circle, we need to draw n number of square, each time rotating the turtle cursor by d degrees. n and d are chosen such that
n*d=360, so as to complete a full circle. In the implementation below we will draw a circle of 60 squares, rotating the cursor each time by 6 degrees.
- fd(x) : draw the cursor forward by x pixels.
- rt(x) : rotates the facing direction of the cursor by x degrees to the right.
Below is the implementation.
- Python | Sum of squares in list
- Python | Product of Squares in List
- Python Bokeh - Plotting Squares on a Graph
- Python Bokeh - Plotting Squares with Xs on a Graph
- Python Bokeh - Plotting Squares with Dots on a Graph
- Python Bokeh - Plotting Squares with Crosses on a Graph
- turtle.circle() method in Python
- Draw Circle in Python using Turtle
- Circle Detection using OpenCV | Python
- Python | Sympy Circle() method
- Python OpenCV | cv2.circle() method
- Wand circle() function in Python
- Matplotlib.patches.Circle class in Python
- Make an Circle Glyphs in Python using Bokeh
- bokeh.plotting.figure.circle() function in Python
- Ordinary Least Squares (OLS) using statsmodels
- PyQt5 – How to create circle Label ?
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Python - Read blob object in python using wand library
- Reading Python File-Like Objects from C | 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.