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