[Python-checkins] r47210 - in python/trunk: Lib/lib-tk/turtle.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Mon Jul 3 12:19:50 CEST 2006


Author: martin.v.loewis
Date: Mon Jul  3 12:19:49 2006
New Revision: 47210

Modified:
   python/trunk/Lib/lib-tk/turtle.py
   python/trunk/Misc/NEWS
Log:
Bug #1514693: Update turtle's heading when switching between
degrees and radians.


Modified: python/trunk/Lib/lib-tk/turtle.py
==============================================================================
--- python/trunk/Lib/lib-tk/turtle.py	(original)
+++ python/trunk/Lib/lib-tk/turtle.py	Mon Jul  3 12:19:49 2006
@@ -30,6 +30,7 @@
         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 @@
         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 @@
         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)

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Jul  3 12:19:49 2006
@@ -19,8 +19,11 @@
 Library
 -------
 
+- Bug #1514693: Update turtle's heading when switching between
+  degrees and radians.
+
 - Reimplement turtle.circle using a polyline, to allow correct
-  filling of arcs. Also fixes #1514693.
+  filling of arcs.
 
 - Bug #1514703: Only setup canvas window in turtle when the canvas
   is created.


More information about the Python-checkins mailing list