from shapes import Triangle, Rectangle, Oval, Paper rect1 = Rectangle() rect1.set_width(200) rect1.set_height(100) rect1.set_color("blue") rect1.draw() rect2 = Rectangle() rect2.set_width(50) rect2.set_height(150) rect2.set_color("yellow") rect2.set_x(100) rect2.set_y(100) rect2.draw() oval1 = Oval() oval1.randomize() oval1.draw() tri1 = Triangle(5, 5, 100, 5, 100, 200) tri1.draw() Paper.display()
from shapes import Paper, Triangle, Rectangle, Oval paper = Paper() rect1 = Rectangle() rect1.set_width(200) rect1.set_height(100) rect1.set_color("blue") rect1.draw() rect2 = Rectangle() rect2.set_x(50) rect2.set_y(30) rect2.set_width(200) rect2.set_height(100) rect2.set_color("orange") rect2.draw() paper.display()
rect1.set_x(100) rect1.set_y(100) rect1.draw() rect2 = Rectangle() rect2.set_width(10) rect2.set_height(10) rect2.set_color('red') rect2.set_x(200) rect2.set_y(100) tri = Triangle(160, 160, 170, 170, 150, 170) tri.set_color('green') tri.set_x(150) tri.set_y(150) rect3 = Rectangle() rect3.set_width(100) rect3.set_height(10) rect3.set_color('red') rect3.set_x(100) rect3.set_y(200) rect1.draw() rect2.draw() rect3.draw() tri.draw() canvas.display()