MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / write

Method write

tools/python-3.11.9-amd64/Lib/turtle.py:3427–3454  ·  view source on GitHub ↗

Write text at the current turtle position. Arguments: arg -- info, which is to be written to the TurtleScreen move (optional) -- True/False align (optional) -- one of the strings "left", "center" or right" font (optional) -- a triple (fontname, fontsize

(self, arg, move=False, align="left", font=("Arial", 8, "normal"))

Source from the content-addressed store, hash-verified

3425 return end
3426
3427 def write(self, arg, move=False, align="left", font=("Arial", 8, "normal")):
3428 """Write text at the current turtle position.
3429
3430 Arguments:
3431 arg -- info, which is to be written to the TurtleScreen
3432 move (optional) -- True/False
3433 align (optional) -- one of the strings "left", "center" or right"
3434 font (optional) -- a triple (fontname, fontsize, fonttype)
3435
3436 Write text - the string representation of arg - at the current
3437 turtle position according to align ("left", "center" or right")
3438 and with the given font.
3439 If move is True, the pen is moved to the bottom-right corner
3440 of the text. By default, move is False.
3441
3442 Example (for a Turtle instance named turtle):
3443 >>> turtle.write('Home = ', True, align="center")
3444 >>> turtle.write((0,0), True)
3445 """
3446 if self.undobuffer:
3447 self.undobuffer.push(["seq"])
3448 self.undobuffer.cumulate = True
3449 end = self._write(str(arg), align.lower(), font)
3450 if move:
3451 x, y = self.pos()
3452 self.setpos(end, y)
3453 if self.undobuffer:
3454 self.undobuffer.cumulate = False
3455
3456 def begin_poly(self):
3457 """Start recording the vertices of a polygon.

Callers 2

write_docstringdictFunction · 0.45
demo2Function · 0.45

Calls 6

_writeMethod · 0.95
strFunction · 0.85
pushMethod · 0.45
lowerMethod · 0.45
posMethod · 0.45
setposMethod · 0.45

Tested by

no test coverage detected