MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / setheading

Method setheading

Python/Turtle.py:1809–1835  ·  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: logo-

(self, to_angle)

Source from the content-addressed store, hash-verified

1807 return (self._angleOffset + self._angleOrient*result) % self._fullcircle
1808
1809 def setheading(self, to_angle):
1810 """Set the orientation of the turtle to to_angle.
1811
1812 Aliases: setheading | seth
1813
1814 Argument:
1815 to_angle -- a number (integer or float)
1816
1817 Set the orientation of the turtle to to_angle.
1818 Here are some common directions in degrees:
1819
1820 standard - mode: logo-mode:
1821 -------------------|--------------------
1822 0 - east 0 - north
1823 90 - north 90 - east
1824 180 - west 180 - south
1825 270 - south 270 - west
1826
1827 Example (for a Turtle instance named turtle):
1828 >>> turtle.setheading(90)
1829 >>> turtle.heading()
1830 90
1831 """
1832 angle = (to_angle - self.heading())*self._angleOrient
1833 full = self._fullcircle
1834 angle = (angle+full/2.)%full - full/2.
1835 self._rotate(angle)
1836
1837 def circle(self, radius, extent = None, steps = None):
1838 """ Draw a circle with given radius.

Callers 2

homeMethod · 0.95
demo2Function · 0.80

Calls 2

headingMethod · 0.95
_rotateMethod · 0.95

Tested by

no test coverage detected