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"))
| 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. |