Set/return turtle's stretchfactors/outline. Set resizemode to "user". Optional arguments: stretch_wid : positive number stretch_len : positive number outline : positive number Return or set the pen's attributes x/y-stretchfactors and/or outline.
(self, stretch_wid=None, stretch_len=None, outline=None)
| 2910 | self._update() |
| 2911 | |
| 2912 | def shapesize(self, stretch_wid=None, stretch_len=None, outline=None): |
| 2913 | """Set/return turtle's stretchfactors/outline. Set resizemode to "user". |
| 2914 | |
| 2915 | Optional arguments: |
| 2916 | stretch_wid : positive number |
| 2917 | stretch_len : positive number |
| 2918 | outline : positive number |
| 2919 | |
| 2920 | Return or set the pen's attributes x/y-stretchfactors and/or outline. |
| 2921 | Set resizemode to "user". |
| 2922 | If and only if resizemode is set to "user", the turtle will be displayed |
| 2923 | stretched according to its stretchfactors: |
| 2924 | stretch_wid is stretchfactor perpendicular to orientation |
| 2925 | stretch_len is stretchfactor in direction of turtles orientation. |
| 2926 | outline determines the width of the shapes's outline. |
| 2927 | |
| 2928 | Examples (for a Turtle instance named turtle): |
| 2929 | >>> turtle.resizemode("user") |
| 2930 | >>> turtle.shapesize(5, 5, 12) |
| 2931 | >>> turtle.shapesize(outline=8) |
| 2932 | """ |
| 2933 | if stretch_wid is stretch_len is outline is None: |
| 2934 | stretch_wid, stretch_len = self._stretchfactor |
| 2935 | return stretch_wid, stretch_len, self._outlinewidth |
| 2936 | if stretch_wid == 0 or stretch_len == 0: |
| 2937 | raise TurtleGraphicsError("stretch_wid/stretch_len must not be zero") |
| 2938 | if stretch_wid is not None: |
| 2939 | if stretch_len is None: |
| 2940 | stretchfactor = stretch_wid, stretch_wid |
| 2941 | else: |
| 2942 | stretchfactor = stretch_wid, stretch_len |
| 2943 | elif stretch_len is not None: |
| 2944 | stretchfactor = self._stretchfactor[0], stretch_len |
| 2945 | else: |
| 2946 | stretchfactor = self._stretchfactor |
| 2947 | if outline is None: |
| 2948 | outline = self._outlinewidth |
| 2949 | self.pen(resizemode="user", |
| 2950 | stretchfactor=stretchfactor, outline=outline) |
| 2951 | |
| 2952 | def shearfactor(self, shear=None): |
| 2953 | """Set or return the current shearfactor. |