MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / heading

Method heading

tools/python-3.11.9-amd64/Lib/turtle.py:1896–1909  ·  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

1894 return (self._angleOffset + self._angleOrient*result) % self._fullcircle
1895
1896 def heading(self):
1897 """ Return the turtle's current heading.
1898
1899 No arguments.
1900
1901 Example (for a Turtle instance named turtle):
1902 >>> turtle.left(67)
1903 >>> turtle.heading()
1904 67.0
1905 """
1906 x, y = self._orient
1907 result = round(math.degrees(math.atan2(y, x)), 10) % 360.0
1908 result /= self._degreesPerAU
1909 return (self._angleOffset + self._angleOrient*result) % self._fullcircle
1910
1911 def setheading(self, to_angle):
1912 """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