def appInit(self): """ Setup the scene and add the shapes to it """ glClearColor(1.0, 1.0, 1.0, 1.0) glColor(0.0, 0.0, 0.0) glPointSize(4.0) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(0.0, WINDOW_WIDTH, 0.0, WINDOW_HEIGHT) self.scene = Scene() tri = Triangle() tri.set_location(10, 50) tri.set_color(0, 1, 1) self.scene.addShape(tri) tri = Triangle() tri.set_location(70, 50) tri.set_color(1, 0, 1) tri.set_size(2, 2) self.scene.addShape(tri) tri = Triangle() tri.set_location(300, 50) self.scene.addShape(tri)
def appInit(self): """ Create the scene and intitialize the shapes to be put in the scene """ self.shapes = [] # set viewing projection glClearColor(1.0, 1.0, 1.0, 0.0) glColor(0.0, 0.0, 0.0) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(0.0, WINDOW_WIDTH, 0.0, WINDOW_HEIGHT) tri = Triangle() tri.set_location(10, 50) tri.set_color(0, 1, 1) self.shapes.append(tri) tri = Triangle() tri.set_location(70, 50) tri.set_color(1, 0, 1) tri.set_size(2, 2) self.shapes.append(tri) tri = Triangle() tri.set_location(300, 50) self.shapes.append(tri)
def appInit(self): """ Setup the scene and add the shapes to it """ self.shapes = [] glClearColor(1.0, 1.0, 1.0, 1.0) glColor(0.0, 0.0, 0.0) # glPointSize(4.0) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(0.0, WINDOW_WIDTH, 0.0, WINDOW_HEIGHT) tri = Triangle() tri.set_location(10, 50) tri.set_color(0, 1, 1) self.shapes.append(tri) tri = Triangle() tri.set_location(70, 50) tri.set_color(1, 0, 1) tri.set_size(2, 2) self.shapes.append(tri) tri = Triangle() tri.set_location(300, 50) self.shapes.append(tri) self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
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()
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()
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 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()
path = Rectangle() path.set_x(265) path.set_y(425) path.set_width(70) path.set_height(75) path.set_color("brown") path.draw() window_l = Rectangle() window_l.set_x(175) window_l.set_y(300) window_l.set_width(65) window_l.set_height(65) window_l.set_color("lightblue") window_l.draw() window_r = Rectangle() window_r.set_x(360) window_r.set_y(300) window_r.set_width(65) window_r.set_height(65) window_r.set_color("lightblue") window_r.draw() roof = Triangle(150, 250, 300, 150, 450, 250) roof.set_color("purple") roof.draw() Paper.display()
from shapes import Triangle, Rectangle, Oval rect1 = Rectangle() rect2 = Rectangle() oval1 = Oval() tri1 = Triangle() rect1.set_width(200) rect1.set_height(100) rect1.set_color("blue") rect1.draw() rect2.set_x(150) rect2.set_y(150) rect2.set_width(50) rect2.set_height(150) rect2.set_color("yellow") rect2.draw() oval1.randomize() oval1.draw() tri1 = Triangle(5, 5, 100, 5, 100, 200) tri1.set_color("red") tri1.draw()
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) rect1.draw() rect2.draw() rect3.draw() tri.draw()
rect1.set_width(200) rect1.set_height(100) rect1.set_color("blue") #invoking draw method rect1.draw() # Paper.display() # Challenge Rectangle rect2 = Rectangle() rect2.set_x(100) rect2.set_y(100) rect2.set_width(50) rect2.set_height(150) rect2.set_color("yellow") #Challenge Oval oval1 = Oval(100,100) oval1.randomize() oval1.draw() rect2.draw() # Challenge Triangle tri1 = Triangle(5,5,100,5,100,200) tri1.set_color("green") tri1.draw() Paper.display()
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()
self.label.pack() self.close_button = Button(master, text="Close", command=master.quit) self.close_button.pack() rectangle1 = Rectangle() rectangle1.set_width(200) 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)
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()