| 580 | return Point((p1.x+p2.x)/2.0, (p1.y+p2.y)/2.0) |
| 581 | |
| 582 | class Rectangle(_BBox): |
| 583 | |
| 584 | def __init__(self, p1, p2): |
| 585 | _BBox.__init__(self, p1, p2) |
| 586 | |
| 587 | def _draw(self, canvas, options): |
| 588 | p1 = self.p1 |
| 589 | p2 = self.p2 |
| 590 | x1,y1 = canvas.toScreen(p1.x,p1.y) |
| 591 | x2,y2 = canvas.toScreen(p2.x,p2.y) |
| 592 | return canvas.create_rectangle(x1,y1,x2,y2,options) |
| 593 | |
| 594 | def __str__(self): |
| 595 | return "Rect: %s to %s" % (self.p1.coordStr(), self.p2.coordStr()) |
| 596 | |
| 597 | |
| 598 | def clone(self): |
| 599 | other = Rectangle(self.p1, self.p2) |
| 600 | other.config = self.config.copy() |
| 601 | return other |
| 602 | |
| 603 | class Oval(_BBox): |
| 604 |
no outgoing calls
no test coverage detected