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()
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()
Exemple #3
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()
Exemple #4
0
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()

ov1 = Oval()
ov1.randomize()
ov1.draw()

Paper.display()
Exemple #5
0
rect1 = Rectangle()
rect2 = Rectangle()
oval1 = Oval()
triangle = Triangle(0,0,20,0,40,40,color="black")

# Attributes
rect1.set_width(200)
rect1.set_height(100)
rect1.set_color("blue")


rect2.set_width(50)
rect2.set_height(150)
rect2.set_color("yellow")

oval1.randomize(smallest=20, largest=200)

# setting the position of the rect1
rect2.set_y(100)
rect2.set_x(100)


# draw the rectangle on paper
rect1.draw()
rect2.draw()
oval1.draw()
triangle.draw()

# to display the shape on the paper
paper.display()
Exemple #6
0
from shapes import Triangle, Rectangle, Oval

rect1 = Rectangle()

rect1.set_width(200)
rect1.set_height(100)
rect1.set_color("blue")
rect1.draw()

rec2 = Rectangle()

rec2.set_width(50)
rec2.set_height(150)
rec2.set_color("yellow")
rec2.draw()
rec2.set_x(100)
rec2.set_y(100)

ov1 = Oval()

ov1.randomize(20)
ov1.draw()

tri1 = Triangle(5, 10, 100, 5, 100, 200)
tri1.draw()
Exemple #7
0
from shapes import Triangle, Oval, Rectangle
from random import randint


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

rect2 = Rectangle()
rect2.set_width(randint(10,150))
rect2.set_height(randint(10,150))
rect2.set_color("red")
rect2.set_x(randint(0,400))
rect2.set_y(randint (0,400))

ovl1=Oval()
ovl1.randomize()

tri1 = Triangle()
tri1.randomize()
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()