summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/turtle.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-07-03 10:19:49 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-07-03 10:19:49 (GMT)
commit2b88f63a3c78755ff19d8e535fbe93a2f16a87d3 (patch)
tree7d11b6db43a5ff7d0a4757fe21709f0970b7fb18 /Lib/lib-tk/turtle.py
parent4c4300de4e0f7d598da8769bbd7523748167249e (diff)
downloadcpython-2b88f63a3c78755ff19d8e535fbe93a2f16a87d3.zip
cpython-2b88f63a3c78755ff19d8e535fbe93a2f16a87d3.tar.gz
cpython-2b88f63a3c78755ff19d8e535fbe93a2f16a87d3.tar.bz2
Bug #1514693: Update turtle's heading when switching between
degrees and radians.
Diffstat (limited to 'Lib/lib-tk/turtle.py')
-rw-r--r--Lib/lib-tk/turtle.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py
index cc5ffa1..90d1aa3 100644
--- a/Lib/lib-tk/turtle.py
+++ b/Lib/lib-tk/turtle.py
@@ -30,6 +30,7 @@ class RawPen:
self._tracing = 1
self._arrow = 0
self._delay = 10 # default delay for drawing
+ self._angle = 0.0
self.degrees()
self.reset()
@@ -39,6 +40,10 @@ class RawPen:
Example:
>>> turtle.degrees()
"""
+ # Don't try to change _angle if it is 0, because
+ # _fullcircle might not be set, yet
+ if self._angle:
+ self._angle = (self._angle / self._fullcircle) * fullcircle
self._fullcircle = fullcircle
self._invradian = pi / (fullcircle * 0.5)
@@ -365,7 +370,7 @@ class RawPen:
steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac)
w = 1.0 * extent / steps
w2 = 0.5 * w
- l = 2.0 * radius * sin(w2*self._invradian)
+ l = 2.0 * radius * sin(w2*self._invradian)
if radius < 0:
l, w, w2 = -l, -w, -w2
self.left(w2)