def draw(self): my_canvas = shapemodule.Canvas(40, 12) circle = shapemodule.Circle(4, 5, 5) circle.paint(my_canvas, '| ') dot1 = shapemodule.Rectangle(2, 3, 1, 1) dot1.paint(my_canvas, '( ') dot2 = shapemodule.Rectangle(8, 3, 1, 1) dot2.paint(my_canvas, ') ') top = shapemodule.Rectangle(3, 2, 5, 1) top.paint(my_canvas, 'n ') side1 = shapemodule.Rectangle(2, 6, 1, 1) side1.paint(my_canvas, '\\ ') side2 = shapemodule.Rectangle(8, 6, 1, 1) side2.paint(my_canvas, '/ ') side3 = shapemodule.Rectangle(3, 7, 1, 1) side3.paint(my_canvas, '\\ ') side4 = shapemodule.Rectangle(7, 7, 1, 1) side4.paint(my_canvas, '/ ') side5 = shapemodule.Rectangle(4, 8, 1, 1) side5.paint(my_canvas, '/ ') side6 = shapemodule.Rectangle(6, 8, 1, 1) side6.paint(my_canvas, '\\ ') base = shapemodule.Rectangle(3, 9, 5, 1) base.paint(my_canvas, '- ') my_canvas.display()
def drawfallen(self): if self.type == 'maple': mycanvas = shapemodule.Canvas(40, 23) trunk = shapemodule.Rectangle(11, 11, 7, 3) trunk.paint(mycanvas, '– ') stump = shapemodule.Rectangle(7, 12, 3, 2) stump.paint(mycanvas, '| ') leaves = shapemodule.Circle(5, 22, 12) leaves.paint(mycanvas, 'O ') cover = shapemodule.Rectangle(19, 15, 7, 2) cover.paint(mycanvas, ' ') mycanvas.display() if self.type == 'cedar': mycanvas = shapemodule.Canvas(40, 23) triangle = shapemodule.RightTri(4, 45, 25, 13, 'RU') triangle.paint(mycanvas, '> ') triangle2 = shapemodule.RightTri(5, 45, 21, 12, 'RU') triangle2.paint(mycanvas, '> ') triangle3 = shapemodule.RightTri(6, 45, 16, 11, 'RU') triangle3.paint(mycanvas, '> ') trunk = shapemodule.Rectangle(13, 14, 3, 3) trunk.paint(mycanvas, '- ') stump = shapemodule.Rectangle(9, 15, 3, 2) stump.paint(mycanvas, '| ') mycanvas.display()
def draw(self): mycanvas = shapemodule.Canvas(40, 22) stick = shapemodule.Rectangle(6, 10, 8, 3) stick.paint(mycanvas, '- ') twig1 = shapemodule.Rectangle(11, 8, 1, 2) twig1.paint(mycanvas, '/ ') twig2 = shapemodule.Rectangle(10, 9, 1, 1) twig2.paint(mycanvas, '/ ') leaf = shapemodule.Circle(2, 12, 7) leaf.paint(mycanvas, '0 ') mycanvas.display()
def draw(self): if self.type == 'maple': mycanvas = shapemodule.Canvas(40, 23) trunk = shapemodule.Rectangle(9, 11, 3, 7) trunk.paint(mycanvas, '| ') leaves = shapemodule.Circle(5, 10, 6) leaves.paint(mycanvas, 'O ') mycanvas.display() if self.type == 'cedar': mycanvas = shapemodule.Canvas(40, 23) triangle = shapemodule.Triangle(4, 45, 10, 3) triangle.paint(mycanvas, '^ ') triangle2 = shapemodule.Triangle(5, 45, 10, 6) triangle2.paint(mycanvas, '^ ') triangle3 = shapemodule.Triangle(6, 45, 10, 9) triangle3.paint(mycanvas, '^ ') trunk = shapemodule.Rectangle(9, 15, 3, 4) trunk.paint(mycanvas, '| ') mycanvas.display()
def draw(self): if self.name == 'softwood': mycanvas = shapemodule.Canvas(40, 22) end = shapemodule.RightTri(3, 45, 8, 8, 'LU') end.paint(mycanvas, '* ') length = shapemodule.Rectangle(9, 8, 5, 3) length.paint(mycanvas, '= ') mycanvas.display() elif self.name == 'wood': mycanvas = shapemodule.Canvas(40, 22) end = shapemodule.RightTri(3, 45, 8, 8, 'LU') end.paint(mycanvas, '* ') length = shapemodule.Rectangle(9, 8, 5, 3) length.paint(mycanvas, '- ') mycanvas.display() elif self.name == 'hardwood': mycanvas = shapemodule.Canvas(40, 22) end = shapemodule.RightTri(3, 45, 8, 8, 'LU') end.paint(mycanvas, '0 ') length = shapemodule.Rectangle(9, 8, 5, 3) length.paint(mycanvas, '- ') mycanvas.display()
def draw(self): mycanvas = shapemodule.Canvas(5, 5) block = shapemodule.Rectangle(0, 0, 5, 5) block.paint(mycanvas, '* ')