Exemplo n.º 1
0
from shapes import Paper, Triangle, Rectangle, Oval

paper = Paper()

rect1 = Rectangle()
rect1.set_width(200)
rect1.set_height(100)
rect1.set_color("orange")
rect1.draw()

rect2 = Rectangle()
rect2.set_width(200)
rect2.set_height(100)
rect2.set_color("yellow")
rect2.set_x(100)
rect2.set_y(100)
rect2.draw()

tri1 = Triangle(5, 5, 12, 5, 20, 30)
tri1.set_color("purple")
tri1.set_x(398)
tri1.set_y(500)
tri1.draw()

oval1 = Oval()
oval1.randomize(25, 100)
oval1.draw()

paper.display()
Exemplo n.º 2
0
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)

rect1.draw()
rect2.draw()
rect3.draw()
tri.draw()

canvas.display()
Exemplo n.º 3
0
rect1 = Rectangle()
rect1.set_width(200)
rect1.set_width(100)
rect1.set_color("blue")

rect1.draw()

rect2 = Rectangle()
rect2.set_x(100)
rect2.set_y(100)
rect2.set_width(100)
rect2.set_width(50)
rect2.set_color("red")

rect2.draw()

oval = Oval()
oval.randomize()

oval.draw()

triangle = Triangle(5, 5, 100, 100, 200, 100)
triangle.set_x(150)
triangle.set_y(250)
triangle.set_color("green")

triangle.draw()

paper.display()
Exemplo n.º 4
0
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.draw()
rect2.set_x(300)
rect2.set_y(100)

ov1 = Oval()
ov1.set_width(200)
ov1.set_height(100)
ov1.set_color("black")
ov1.set_x(200)
ov1.draw()

ov2 = Oval()
ov2.randomize()
ov2.draw()

tri = Triangle(5, 5, 100, 200)
tri.set_x(350)
tri.set_color("red")
tri.draw()

paper.display()