MCPcopy Index your code
hub / github.com/csev/py4e / Rectangle

Class Rectangle

code/graphics/graphics.py:582–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580 return Point((p1.x+p2.x)/2.0, (p1.y+p2.y)/2.0)
581
582class 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
603class Oval(_BBox):
604

Callers 2

cloneMethod · 0.85
histogram.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected