Set turtle shape to shape with given name / return current shapename. Optional argument: name -- a string, which is a valid shapename Set turtle shape to shape with given name or, if name is not given, return name of current shape. Shape with name mus
(self, name=None)
| 2752 | return q |
| 2753 | |
| 2754 | def shape(self, name=None): |
| 2755 | """Set turtle shape to shape with given name / return current shapename. |
| 2756 | |
| 2757 | Optional argument: |
| 2758 | name -- a string, which is a valid shapename |
| 2759 | |
| 2760 | Set turtle shape to shape with given name or, if name is not given, |
| 2761 | return name of current shape. |
| 2762 | Shape with name must exist in the TurtleScreen's shape dictionary. |
| 2763 | Initially there are the following polygon shapes: |
| 2764 | 'arrow', 'turtle', 'circle', 'square', 'triangle', 'classic'. |
| 2765 | To learn about how to deal with shapes see Screen-method register_shape. |
| 2766 | |
| 2767 | Example (for a Turtle instance named turtle): |
| 2768 | >>> turtle.shape() |
| 2769 | 'arrow' |
| 2770 | >>> turtle.shape("turtle") |
| 2771 | >>> turtle.shape() |
| 2772 | 'turtle' |
| 2773 | """ |
| 2774 | if name is None: |
| 2775 | return self.turtle.shapeIndex |
| 2776 | if not name in self.screen.getshapes(): |
| 2777 | raise TurtleGraphicsError("There is no shape named %s" % name) |
| 2778 | self.turtle._setshape(name) |
| 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". |