Posts

Showing posts from September, 2020

Tutorial: Rounded Rectangle or Square with Python Turtle

Image
https://pythonturtle.academy/tutorial-round-rectangle-or-square-with-python-turtle/   In this tutorial we are going to show how to draw rectangles or squares with round corners. Round Rectangle We will start by drawing the bottom straight-line with blue color. The following is the code snippet: turtle.up() turtle.goto(-200,-150) turtle.color('blue') turtle.down() turtle.dot() turtle.fd(400) turtle.dot() It should draw the following shape. The blue dots were drawn to show the starting and end points. They will be removed later. We are going to draw the round corners with 90 degree arc of a circle in red color. The radius of the arc can be any number. Smaller radius generates smaller round corners. The following is the code snippet for drawing the round corner: turtle.up() turtle.goto(-200,-150) turtle.color('blue') turtle.down() turtle.dot() turtle.fd(400) turtle.dot() turtle.color('red') turtle.circle(100,90) turtle.dot() It should draw a shape like this: The ne