MCPcopy Index your code
hub / github.com/python/cpython / heading

Method heading

Lib/turtle.py:1963–1976  ·  view source on GitHub ↗

Return the turtle's current heading. No arguments. Example (for a Turtle instance named turtle): >>> turtle.left(67) >>> turtle.heading() 67.0

(self)

Source from the content-addressed store, hash-verified

1961 return (self._angleOffset + self._angleOrient*result) % self._fullcircle
1962
1963 def heading(self):
1964 """ Return the turtle's current heading.
1965
1966 No arguments.
1967
1968 Example (for a Turtle instance named turtle):
1969 >>> turtle.left(67)
1970 >>> turtle.heading()
1971 67.0
1972 """
1973 x, y = self._orient
1974 result = round(math.degrees(math.atan2(y, x)), 10) % 360.0
1975 result /= self._degreesPerAU
1976 return (self._angleOffset + self._angleOrient*result) % self._fullcircle
1977
1978 def setheading(self, to_angle):
1979 """Set the orientation of the turtle to to_angle.

Callers 1

setheadingMethod · 0.95

Calls 1

degreesMethod · 0.80

Tested by

no test coverage detected