MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / _write

Method _write

Python/Turtle.py:484–497  ·  view source on GitHub ↗

Write txt at pos in canvas with specified font and color. Return text item and x-coord of right bottom corner of text's bounding box.

(self, pos, txt, align, font, pencolor)

Source from the content-addressed store, hash-verified

482 return self.cv.cget("bg")
483
484 def _write(self, pos, txt, align, font, pencolor):
485 """Write txt at pos in canvas with specified font
486 and color.
487 Return text item and x-coord of right bottom corner
488 of text's bounding box."""
489 x, y = pos
490 x = x * self.xscale
491 y = y * self.yscale
492 anchor = {"left":"sw", "center":"s", "right":"se" }
493 item = self.cv.create_text(x-1, -y, text = txt, anchor = anchor[align],
494 fill = pencolor, font = font)
495 x0, y0, x1, y1 = self.cv.bbox(item)
496 self.cv.update()
497 return item, x1-1
498
499## def _dot(self, pos, size, color):
500## """may be implemented for some other graphics toolkit"""

Callers

nothing calls this directly

Calls 2

bboxMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected