# set the attributes: #rect_1.set_width(200) #rect_1.set_height(100) #rect_1.set_color('blue') # draw the rectangle: rect_1.draw() # create an oval: oval_1 = Oval() oval_1.set_width(100) oval_1.set_height(50) oval_1.set_color('yellow') oval_1.set_x(100) oval_1.set_y(200) oval_1.draw() rect_2 = Rectangle() #rect_2.set_width(100) #rect_2.set_height(150) #rect_2.set_color('yellow') #rect_2.set_x(100) #rect_2.set_y(75) #rect_2.draw() oval_2 = Oval()
rectangle1.set_height(100) rectangle1.set_color("blue") rectangle1.set_x(50) rectangle1.set_y(250) triangle1 = Triangle() # triangle1.randomise() triangle1.set_color("red") triangle1.x=150 triangle1.y=150 triangle1.x2=150 triangle1.y2=200 triangle1.x3=200 triangle1.y3=150 oval1 = Oval() # oval1.randomise() oval1.set_color("green") oval1.set_x(300) oval1.set_y(300) oval1.set_height(200) oval1.set_width(200) rectangle1.draw() oval1.draw() triangle1.draw() root = Tk() gui = MyGUI(root) root.mainloop()
from shapes import Triangle, Rectangle, Oval, Paper sky = Rectangle() sky.set_x(100) sky.set_y(100) sky.set_width(400) sky.set_height(200) sky.set_color("lightblue") sky.draw() sun = Oval() sun.set_width(75) sun.set_height(75) sun.set_x(400) sun.set_y(125) sun.set_color("yellow") sun.draw() grass = Rectangle() grass.set_x(100) grass.set_y(300) grass.set_width(400) grass.set_height(200) grass.set_color("green") grass.draw() wall = Rectangle() wall.set_x(150) wall.set_y(250) wall.set_width(300) wall.set_height(175)
from shapes import Triangle, Rectangle, Oval mouth = Rectangle() mouth.set_width(200) mouth.set_height(100) mouth.set_color('blue') mouth.set_x(200) mouth.set_y(450) mouth.draw() nose = Oval() nose.set_width(100) nose.set_height(100) nose.set_color('red') nose.set_x(250) nose.set_y(250) nose.draw() left_eye = Rectangle() left_eye.set_width(100) left_eye.set_height(100) left_eye.set_color('blue') left_eye.set_x(100) left_eye.set_y(100) left_eye.draw() left_pupil = Oval() left_pupil.set_width(100) left_pupil.set_height(100) left_pupil.set_color('red') left_pupil.set_x(150)
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(150) rect2.set_y(100) rect2.draw() tri = Triangle(5, 5, 100, 5, 100, 200) tri.set_color("red") tri.draw() egg = Oval() egg.set_color("tan") egg.set_height(200) egg.set_width(150) egg.set_x(250) egg.set_y(10) egg.draw() star1 = Triangle(5, 300, 55, 350, 105, 300, 'black') star1.draw() star2 = Triangle(5, 325, 55, 275, 105, 325, 'black') star2.draw() cir = Oval() cir.set_color("green") cir.set_height(50) cir.set_width(50) cir.set_x(150) cir.draw()
rect1 = Rectangle() rect1.set_width(100) rect1.set_height(200) rect1.set_color('blue') rect1.draw() rect2 = Rectangle() rect2.set_width(50) rect2.set_height(150) rect2.set_color('red') rect2.set_x(100) rect2.set_y(100) rect2.draw() # Oval oval1 = Oval() oval1.set_color('white') oval1.set_x(30) oval1.set_y(90) oval1.draw() #Triangle tri = Triangle() tri.randomize() tri.set_color('blue') tri.draw()