Turns turtle animation on/off and set delay for update drawings. Optional arguments: n -- nonnegative integer delay -- nonnegative integer If n is given, only each n-th regular screen update is really performed. (Can be used to accelerate the drawing of co
(self, n=None, delay=None)
| 1251 | return color |
| 1252 | |
| 1253 | def tracer(self, n=None, delay=None): |
| 1254 | """Turns turtle animation on/off and set delay for update drawings. |
| 1255 | |
| 1256 | Optional arguments: |
| 1257 | n -- nonnegative integer |
| 1258 | delay -- nonnegative integer |
| 1259 | |
| 1260 | If n is given, only each n-th regular screen update is really performed. |
| 1261 | (Can be used to accelerate the drawing of complex graphics.) |
| 1262 | Second arguments sets delay value (see RawTurtle.delay()) |
| 1263 | |
| 1264 | Example (for a TurtleScreen instance named screen): |
| 1265 | >>> screen.tracer(8, 25) |
| 1266 | >>> dist = 2 |
| 1267 | >>> for i in range(200): |
| 1268 | ... fd(dist) |
| 1269 | ... rt(90) |
| 1270 | ... dist += 2 |
| 1271 | """ |
| 1272 | if n is None: |
| 1273 | return self._tracing |
| 1274 | self._tracing = int(n) |
| 1275 | self._updatecounter = 0 |
| 1276 | if delay is not None: |
| 1277 | self._delayvalue = int(delay) |
| 1278 | if self._tracing: |
| 1279 | self.update() |
| 1280 | |
| 1281 | def delay(self, delay=None): |
| 1282 | """ Return or set the drawing delay in milliseconds. |