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, font
(self, arg, move=False, align="left", font=("Arial", 8, "normal"))
| 3306 | return end |
| 3307 | |
| 3308 | def write(self, arg, move=False, align="left", font=("Arial", 8, "normal")): |
| 3309 | """Write text at the current turtle position. |
| 3310 | |
| 3311 | Arguments: |
| 3312 | arg -- info, which is to be written to the TurtleScreen |
| 3313 | move (optional) -- True/False |
| 3314 | align (optional) -- one of the strings "left", "center" or right" |
| 3315 | font (optional) -- a triple (fontname, fontsize, fonttype) |
| 3316 | |
| 3317 | Write text - the string representation of arg - at the current |
| 3318 | turtle position according to align ("left", "center" or right") |
| 3319 | and with the given font. |
| 3320 | If move is True, the pen is moved to the bottom-right corner |
| 3321 | of the text. By default, move is False. |
| 3322 | |
| 3323 | Example (for a Turtle instance named turtle): |
| 3324 | >>> turtle.write('Home = ', True, align="center") |
| 3325 | >>> turtle.write((0,0), True) |
| 3326 | """ |
| 3327 | if self.undobuffer: |
| 3328 | self.undobuffer.push(["seq"]) |
| 3329 | self.undobuffer.cumulate = True |
| 3330 | end = self._write(str(arg), align.lower(), font) |
| 3331 | if move: |
| 3332 | x, y = self.pos() |
| 3333 | self.setpos(end, y) |
| 3334 | if self.undobuffer: |
| 3335 | self.undobuffer.cumulate = False |
| 3336 | |
| 3337 | def begin_poly(self): |
| 3338 | """Start recording the vertices of a polygon. |
no test coverage detected