MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / shapesize

Method shapesize

tools/python-3.11.9-amd64/Lib/turtle.py:2781–2819  ·  view source on GitHub ↗

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 outl

(self, stretch_wid=None, stretch_len=None, outline=None)

Source from the content-addressed store, hash-verified

2779 self._update()
2780
2781 def shapesize(self, stretch_wid=None, stretch_len=None, outline=None):
2782 """Set/return turtle's stretchfactors/outline. Set resizemode to "user".
2783
2784 Optional arguments:
2785 stretch_wid : positive number
2786 stretch_len : positive number
2787 outline : positive number
2788
2789 Return or set the pen's attributes x/y-stretchfactors and/or outline.
2790 Set resizemode to "user".
2791 If and only if resizemode is set to "user", the turtle will be displayed
2792 stretched according to its stretchfactors:
2793 stretch_wid is stretchfactor perpendicular to orientation
2794 stretch_len is stretchfactor in direction of turtles orientation.
2795 outline determines the width of the shapes's outline.
2796
2797 Examples (for a Turtle instance named turtle):
2798 >>> turtle.resizemode("user")
2799 >>> turtle.shapesize(5, 5, 12)
2800 >>> turtle.shapesize(outline=8)
2801 """
2802 if stretch_wid is stretch_len is outline is None:
2803 stretch_wid, stretch_len = self._stretchfactor
2804 return stretch_wid, stretch_len, self._outlinewidth
2805 if stretch_wid == 0 or stretch_len == 0:
2806 raise TurtleGraphicsError("stretch_wid/stretch_len must not be zero")
2807 if stretch_wid is not None:
2808 if stretch_len is None:
2809 stretchfactor = stretch_wid, stretch_wid
2810 else:
2811 stretchfactor = stretch_wid, stretch_len
2812 elif stretch_len is not None:
2813 stretchfactor = self._stretchfactor[0], stretch_len
2814 else:
2815 stretchfactor = self._stretchfactor
2816 if outline is None:
2817 outline = self._outlinewidth
2818 self.pen(resizemode="user",
2819 stretchfactor=stretchfactor, outline=outline)
2820
2821 def shearfactor(self, shear=None):
2822 """Set or return the current shearfactor.

Callers 8

__init__Method · 0.80
pushMethod · 0.80
insertMethod · 0.80
__init__Method · 0.80
__init__Method · 0.80
mainFunction · 0.80
__init__Method · 0.80
setupFunction · 0.80

Calls 2

TurtleGraphicsErrorClass · 0.85
penMethod · 0.80

Tested by

no test coverage detected