MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / tracer

Method tracer

Python/Turtle.py:1144–1170  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1142 return color
1143
1144 def tracer(self, n=None, delay=None):
1145 """Turns turtle animation on/off and set delay for update drawings.
1146
1147 Optional arguments:
1148 n -- nonnegative integer
1149 delay -- nonnegative integer
1150
1151 If n is given, only each n-th regular screen update is really performed.
1152 (Can be used to accelerate the drawing of complex graphics.)
1153 Second arguments sets delay value (see RawTurtle.delay())
1154
1155 Example (for a TurtleScreen instance named screen):
1156 >>> screen.tracer(8, 25)
1157 >>> dist = 2
1158 >>> for i in range(200):
1159 ... fd(dist)
1160 ... rt(90)
1161 ... dist += 2
1162 """
1163 if n is None:
1164 return self._tracing
1165 self._tracing = int(n)
1166 self._updatecounter = 0
1167 if delay is not None:
1168 self._delayvalue = int(delay)
1169 if self._tracing:
1170 self.update()
1171
1172 def delay(self, delay=None):
1173 """ Return or set the drawing delay in milliseconds.

Callers 2

pong.pyFile · 0.80
_tracerMethod · 0.80

Calls 1

updateMethod · 0.95

Tested by

no test coverage detected