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

Method setheading

tools/python-3.11.9-amd64/Lib/turtle.py:1911–1937  ·  view source on GitHub ↗

Set the orientation of the turtle to to_angle. Aliases: setheading | seth Argument: to_angle -- a number (integer or float) Set the orientation of the turtle to to_angle. Here are some common directions in degrees: standard - mode:

(self, to_angle)

Source from the content-addressed store, hash-verified

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.
1913
1914 Aliases: setheading | seth
1915
1916 Argument:
1917 to_angle -- a number (integer or float)
1918
1919 Set the orientation of the turtle to to_angle.
1920 Here are some common directions in degrees:
1921
1922 standard - mode: logo-mode:
1923 -------------------|--------------------
1924 0 - east 0 - north
1925 90 - north 90 - east
1926 180 - west 180 - south
1927 270 - south 270 - west
1928
1929 Example (for a Turtle instance named turtle):
1930 >>> turtle.setheading(90)
1931 >>> turtle.heading()
1932 90
1933 """
1934 angle = (to_angle - self.heading())*self._angleOrient
1935 full = self._fullcircle
1936 angle = (angle+full/2.)%full - full/2.
1937 self._rotate(angle)
1938
1939 def circle(self, radius, extent = None, steps = None):
1940 """ Draw a circle with given radius.

Callers 6

homeMethod · 0.95
demo2Function · 0.80
tripieceMethod · 0.80
pentpieceMethod · 0.80
stepMethod · 0.80
tickFunction · 0.80

Calls 2

headingMethod · 0.95
_rotateMethod · 0.95

Tested by

no test coverage detected