Issue1514685
Created on 2006-06-29 21:27 by gregorlingl, last changed 2006-07-03 10:29 by loewis.
| Messages (3) | |||
|---|---|---|---|
| msg28986 - (view) | Author: Gregor Lingl (gregorlingl) | Date: 2006-06-29 21:27 | |
>>> from turtle import *
>>> left(90)
>>> heading()
90.0
>>> radians()
>>> heading()
90.0 # should give pi/2, i.e. 1.5707...
>>> forward(50) # turtle goes in direction 90 rad
# i.e. approx. 116.62 degrees
|
|||
| msg28987 - (view) | Author: Gregor Lingl (gregorlingl) | Date: 2006-06-30 19:04 | |
Logged In: YES
user_id=1547199
Making two changes will correct the bug:
(a) In RawPen.__init__():
def __init__(self, canvas):
self._canvas = canvas
self._items = []
self._tracing = 1
self._arrow = 0
self._delay = 10 # default delay for drawing
# patch for degrees()
## self.degrees() # replace by the following two lines
self._fullcircle = 360.0
self._invradian = pi/180.0
self.reset()
(b) in RawPen.degrees() :
def degrees(self, fullcircle=360.0):
""" Set angle measurement units to degrees.
Example:
>>> turtle.degrees()
"""
# patch for degrees(): add next line
self._angle=self._angle*fullcircle/self._fullcircle
self._fullcircle = fullcircle
self._invradian = pi / (fullcircle * 0.5)
Additional Remark: In order that the function degrees()
works identically to the method of same name it should be
written:
def degrees(fullcircle=360.0): _getpen().degrees(fullcircle)
|
|||
| msg28988 - (view) | Author: Martin v. Löwis (loewis) | Date: 2006-07-03 10:29 | |
Logged In: YES user_id=21627 This is essentially a duplicate of #1514693, which was fixed with r47210. Please provide patches as unified diffs in the future; they would be much easier to process that way. See http://www.python.org/dev/patches/ I don't think the top-level degrees functions should grow a fullcircle argument: this is only to simplify the implementation (i.e. having the state-changing code in a single function). The end user is not expected to pass an argument to degrees() or radians(). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2006-06-29 21:27:11 | gregorlingl | create | |