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)
| 2677 | self._update() |
| 2678 | |
| 2679 | def shapesize(self, stretch_wid=None, stretch_len=None, outline=None): |
| 2680 | """Set/return turtle's stretchfactors/outline. Set resizemode to "user". |
| 2681 | |
| 2682 | Optional arguments: |
| 2683 | stretch_wid : positive number |
| 2684 | stretch_len : positive number |
| 2685 | outline : positive number |
| 2686 | |
| 2687 | Return or set the pen's attributes x/y-stretchfactors and/or outline. |
| 2688 | Set resizemode to "user". |
| 2689 | If and only if resizemode is set to "user", the turtle will be displayed |
| 2690 | stretched according to its stretchfactors: |
| 2691 | stretch_wid is stretchfactor perpendicular to orientation |
| 2692 | stretch_len is stretchfactor in direction of turtles orientation. |
| 2693 | outline determines the width of the shapes's outline. |
| 2694 | |
| 2695 | Examples (for a Turtle instance named turtle): |
| 2696 | >>> turtle.resizemode("user") |
| 2697 | >>> turtle.shapesize(5, 5, 12) |
| 2698 | >>> turtle.shapesize(outline=8) |
| 2699 | """ |
| 2700 | if stretch_wid is stretch_len is outline is None: |
| 2701 | stretch_wid, stretch_len = self._stretchfactor |
| 2702 | return stretch_wid, stretch_len, self._outlinewidth |
| 2703 | if stretch_wid == 0 or stretch_len == 0: |
| 2704 | raise TurtleGraphicsError("stretch_wid/stretch_len must not be zero") |
| 2705 | if stretch_wid is not None: |
| 2706 | if stretch_len is None: |
| 2707 | stretchfactor = stretch_wid, stretch_wid |
| 2708 | else: |
| 2709 | stretchfactor = stretch_wid, stretch_len |
| 2710 | elif stretch_len is not None: |
| 2711 | stretchfactor = self._stretchfactor[0], stretch_len |
| 2712 | else: |
| 2713 | stretchfactor = self._stretchfactor |
| 2714 | if outline is None: |
| 2715 | outline = self._outlinewidth |
| 2716 | self.pen(resizemode="user", |
| 2717 | stretchfactor=stretchfactor, outline=outline) |
| 2718 | |
| 2719 | def shearfactor(self, shear=None): |
| 2720 | """Set or return the current shearfactor. |
no test coverage detected