A context manager for filling a shape. Implicitly ensures the code block is wrapped with begin_fill() and end_fill(). Example (for a Turtle instance named turtle): >>> turtle.color("black", "red") >>> with turtle.fill(): ... turtle.circle(60)
(self)
| 3427 | |
| 3428 | @contextmanager |
| 3429 | def fill(self): |
| 3430 | """A context manager for filling a shape. |
| 3431 | |
| 3432 | Implicitly ensures the code block is wrapped with |
| 3433 | begin_fill() and end_fill(). |
| 3434 | |
| 3435 | Example (for a Turtle instance named turtle): |
| 3436 | >>> turtle.color("black", "red") |
| 3437 | >>> with turtle.fill(): |
| 3438 | ... turtle.circle(60) |
| 3439 | """ |
| 3440 | self.begin_fill() |
| 3441 | try: |
| 3442 | yield |
| 3443 | finally: |
| 3444 | self.end_fill() |
| 3445 | |
| 3446 | def begin_fill(self): |
| 3447 | """Called just before drawing a shape to be filled. |