Drawing a Rectangle Creating a rectangle is much like our other objects except the points must be diagonally opposite corners. Rectangle takes two arguments: Rectangle(Point1(x,y), Point2(x,y). As with all drawing objects, assign it a variable name and use the“dot” notation to have the object rect “call” the draw method. rect = Rectangle(Point(20, 10), pt) rect.draw(myWindow) If you wish to create your own rectangle, change the values created in pt. newRect = Rectangle(Point(20, 10), Point(100, 100) newRect.draw(myWindow) You can also add color using the methods: setFill(“colorname”) setOutline(“colorname”) 1/2 Drawing a Rectangle 2/2
© Copyright 2026 Paperzz