from guizero import App, PushButton from shapes import Triangle, Rectangle, Oval, Paper def changeMe(): r.move(20, -20) t2.move(5, 0) app = App(width=600, height=600) button = PushButton(app, changeMe, text="Click me") p = Paper(app) t = Triangle(p) t.randomize() t.draw() t2 = Triangle(p) t2.randomize() t2.draw() r = Rectangle(p) r.randomize() r.width = 400 r.draw() r.color = 'red' r.width = 20 app.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()
from shapes import Oval, Rectangle, Triangle, Paper canvas = Paper() rect1 = Rectangle() rect1.set_width(10) rect1.set_height(10) rect1.set_color('red') 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)