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

Method setheading

Lib/turtle.py:1978–2004  ·  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

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.
1980
1981 Aliases: setheading | seth
1982
1983 Argument:
1984 to_angle -- a number (integer or float)
1985
1986 Set the orientation of the turtle to to_angle.
1987 Here are some common directions in degrees:
1988
1989 standard - mode: logo-mode:
1990 -------------------|--------------------
1991 0 - east 0 - north
1992 90 - north 90 - east
1993 180 - west 180 - south
1994 270 - south 270 - west
1995
1996 Example (for a Turtle instance named turtle):
1997 >>> turtle.setheading(90)
1998 >>> turtle.heading()
1999 90
2000 """
2001 angle = (to_angle - self.heading())*self._angleOrient
2002 full = self._fullcircle
2003 angle = (angle+full/2.)%full - full/2.
2004 self._rotate(angle)
2005
2006 def circle(self, radius, extent = None, steps = None):
2007 """ Draw a circle with given radius.

Callers 7

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

Calls 2

headingMethod · 0.95
_rotateMethod · 0.95

Tested by 1

test_setheadingMethod · 0.64