| 643 | |
| 644 | |
| 645 | class Line(_BBox): |
| 646 | |
| 647 | def __init__(self, p1, p2): |
| 648 | _BBox.__init__(self, p1, p2, ["arrow","fill","width"]) |
| 649 | self.setFill(DEFAULT_CONFIG['outline']) |
| 650 | self.setOutline = self.setFill |
| 651 | |
| 652 | def clone(self): |
| 653 | other = Line(self.p1, self.p2) |
| 654 | other.config = self.config.copy() |
| 655 | return other |
| 656 | |
| 657 | def _draw(self, canvas, options): |
| 658 | p1 = self.p1 |
| 659 | p2 = self.p2 |
| 660 | x1,y1 = canvas.toScreen(p1.x,p1.y) |
| 661 | x2,y2 = canvas.toScreen(p2.x,p2.y) |
| 662 | return canvas.create_line(x1,y1,x2,y2,options) |
| 663 | |
| 664 | def setArrow(self, option): |
| 665 | if not option in ["first","last","both","none"]: |
| 666 | raise GraphicsError, BAD_OPTION |
| 667 | self._reconfig("arrow", option) |
| 668 | |
| 669 | def __str__(self): |
| 670 | return "Line: %s-%s" % (self.p1.coordStr(), self.p2.coordStr()) |
| 671 | |
| 672 | class Polygon(GraphicsObject): |
| 673 |
no outgoing calls
no test coverage detected