Wednesday, 2 March 2022

Python Program to Draw Square using Rectangle Object

 SCREENSHOT

CODE

#Draw a square using a Rectangle object 

from graphics import *

def main():

    win = GraphWin('Draw Square',300,300)

    center = Point(100,100) 

    rect = Rectangle(Point(30,30), Point(150,150))

    rect.setFill("yellow")

    rect.draw(win) 

main()



No comments:

Post a Comment