from shapes import Paper, Triangle, Rectangle, Oval paper = Paper() 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()
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()
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()
from shapes import Triangle, Rectangle, Oval rect1 = Rectangle() rect1.set_width(200) rect1.set_height(100) rect1.set_color("blue") rect1.draw()
from shapes import Triangle, Rectangle, Oval import random for i in range(100): r = Rectangle() r.set_width(random.randint(10, 100)) r.set_height(random.randint(10, 100)) r.set_x(random.randint(10, 500)) r.set_y(random.randint(10, 500)) col = random.randint(1, 6) if col == 1: r.set_color("red") elif col == 2: r.set_color("blue") elif col == 3: r.set_color("green") elif col == 4: r.set_color("purple") elif col == 5: r.set_color("orange") else: r.set_color("yellow") r.draw()
from shapes import Triangle, Rectangle, Oval rect = Rectangle() rect.set_width(200) rect.set_height(100) rect.set_color('blue') rect.draw() square = Rectangle() square.set_width(50) square.set_height(50) square.set_color('yellow') square.set_x(120) square.set_y(120) square.draw() tri = Triangle(5, 5, 100, 5, 100, 200) tri.set_color('red') tri.draw()
from shapes import Triangle, Rectangle, Oval, Paper rect1 = Rectangle() rect1.set_height(100) rect1.set_width(200) rect1.set_color('orange') rect1.draw() rect2 = Rectangle() rect2.set_x(100) rect2.set_y(100) rect2.set_width(50) rect2.set_height(150) rect2.set_color('yellow') rect2.draw() oval = Oval() oval.randomize() oval.draw() triangle = Triangle(5, 5, 100, 5, 100, 200) triangle.set_color('green') triangle.draw() Paper.display()
from shapes import Paper, Rectangle paper = Paper() rect = Rectangle() rect.set_color('yellow') rect.set_height(50) rect.set_width(150) rect.draw() rect.set_x(0) rect.set_y(0) rect2 = Rectangle() rect2.set_color('blue') rect2.set_height(10) rect2.set_width(10) rect2.draw() rect2.set_x(150) rect2.set_y(200) paper.display()
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)
# RENNIE THE ROBOT # FUTURELEARN, SEPTEMBER 03,2017 # Ashmead ALI 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()
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)
# my_drawings # Rectangle from shapes import Triangle, Rectangle, Oval 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()
from shapes import Triangle, Rectangle, Oval r1 = Rectangle() r1.set_width(200) r1.set_height(100) r1.set_color("blue") r1.draw() r2 = Rectangle() r2.set_width(50) r2.set_height(150) r2.set_color("yellow") r2.set_x(100) r2.set_y(100) r2.draw()