python rectangle code example
Example 1: rectangle in tkinter
from tkinter import *
root = Tk()
c = Canvas(root)
c.pack()
c.create_rectangle(100, 100, 200, 200)
root.mainloop()
Example 2: python how to draw a rectangle
import turtle
for i in range(2):
turtle.forward(20)
turtle.right(90)
turtle.forward(10)
Example 3: python how to draw a rectangle
import turtle
for i in range(2):
turtle.forward(20)
turtle.right(90)
turtle.forward(10)