Temporarily turn off auto-updating the screen. This is useful for drawing complex shapes where even the fastest setting is too slow. Once this context manager is exited, the drawing will be displayed. Example (for a TurtleScreen instance named screen and a T
(self)
| 1295 | |
| 1296 | @contextmanager |
| 1297 | def no_animation(self): |
| 1298 | """Temporarily turn off auto-updating the screen. |
| 1299 | |
| 1300 | This is useful for drawing complex shapes where even the fastest setting |
| 1301 | is too slow. Once this context manager is exited, the drawing will |
| 1302 | be displayed. |
| 1303 | |
| 1304 | Example (for a TurtleScreen instance named screen |
| 1305 | and a Turtle instance named turtle): |
| 1306 | >>> with screen.no_animation(): |
| 1307 | ... turtle.circle(50) |
| 1308 | """ |
| 1309 | tracer = self.tracer() |
| 1310 | try: |
| 1311 | self.tracer(0) |
| 1312 | yield |
| 1313 | finally: |
| 1314 | self.tracer(tracer) |
| 1315 | |
| 1316 | def _incrementudc(self): |
| 1317 | """Increment update counter.""" |