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

Class Point

code/graphics/graphics.py:529–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 pass # must override in subclass
528
529class Point(GraphicsObject):
530 def __init__(self, x, y):
531 GraphicsObject.__init__(self, ["outline", "fill"])
532 self.setFill = self.setOutline
533 self.x = x
534 self.y = y
535
536 def _draw(self, canvas, options):
537 x,y = canvas.toScreen(self.x,self.y)
538 return canvas.create_rectangle(x,y,x+1,y+1,options)
539
540 def _move(self, dx, dy):
541 self.x = self.x + dx
542 self.y = self.y + dy
543
544 def clone(self):
545 other = Point(self.x,self.y)
546 other.config = self.config.copy()
547 return other
548
549 def coordStr(self):
550 return "(%s, %s)" % (approx(self.x), approx(self.y))
551
552 def __str__(self):
553 return "Point" + self.coordStr()
554
555 def getX(self): return self.x
556 def getY(self): return self.y
557
558class _BBox(GraphicsObject):
559 # Internal base class for objects represented by bounding box

Callers 8

getMouseMethod · 0.85
getLastMouseMethod · 0.85
_onClickMethod · 0.85
cloneMethod · 0.85
getCenterMethod · 0.85
__init__Method · 0.85
testFunction · 0.85
histogram.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected