Set or return the current tilt-angle. Optional argument: angle -- number Rotate the turtleshape to point in the direction specified by angle, regardless of its current tilt-angle. DO NOT change the turtle's heading (direction of movement). If angle is
(self, angle=None)
| 2869 | self.tiltangle(angle) |
| 2870 | |
| 2871 | def tiltangle(self, angle=None): |
| 2872 | """Set or return the current tilt-angle. |
| 2873 | |
| 2874 | Optional argument: angle -- number |
| 2875 | |
| 2876 | Rotate the turtleshape to point in the direction specified by angle, |
| 2877 | regardless of its current tilt-angle. DO NOT change the turtle's |
| 2878 | heading (direction of movement). |
| 2879 | If angle is not given: return the current tilt-angle, i. e. the angle |
| 2880 | between the orientation of the turtleshape and the heading of the |
| 2881 | turtle (its direction of movement). |
| 2882 | |
| 2883 | (Incorrectly marked as deprecated since Python 3.1, it is really |
| 2884 | settiltangle that is deprecated.) |
| 2885 | |
| 2886 | Examples (for a Turtle instance named turtle): |
| 2887 | >>> turtle.shape("circle") |
| 2888 | >>> turtle.shapesize(5, 2) |
| 2889 | >>> turtle.tiltangle() |
| 2890 | 0.0 |
| 2891 | >>> turtle.tiltangle(45) |
| 2892 | >>> turtle.tiltangle() |
| 2893 | 45.0 |
| 2894 | >>> turtle.stamp() |
| 2895 | >>> turtle.fd(50) |
| 2896 | >>> turtle.tiltangle(-45) |
| 2897 | >>> turtle.tiltangle() |
| 2898 | 315.0 |
| 2899 | >>> turtle.stamp() |
| 2900 | >>> turtle.fd(50) |
| 2901 | """ |
| 2902 | if angle is None: |
| 2903 | tilt = -math.degrees(self._tilt) * self._angleOrient |
| 2904 | return (tilt / self._degreesPerAU) % self._fullcircle |
| 2905 | else: |
| 2906 | tilt = -angle * self._degreesPerAU * self._angleOrient |
| 2907 | tilt = math.radians(tilt) % math.tau |
| 2908 | self.pen(resizemode="user", tilt=tilt) |
| 2909 | |
| 2910 | def tilt(self, angle): |
| 2911 | """Rotate the turtleshape by angle. |
no test coverage detected