Create and return a clone of the turtle. No argument. Create and return a clone of the turtle with same position, heading and turtle properties. Example (for a Turtle instance named mick): mick = Turtle() joe = mick.clone()
(self)
| 2712 | return "#%02x%02x%02x" % (r, g, b) |
| 2713 | |
| 2714 | def clone(self): |
| 2715 | """Create and return a clone of the turtle. |
| 2716 | |
| 2717 | No argument. |
| 2718 | |
| 2719 | Create and return a clone of the turtle with same position, heading |
| 2720 | and turtle properties. |
| 2721 | |
| 2722 | Example (for a Turtle instance named mick): |
| 2723 | mick = Turtle() |
| 2724 | joe = mick.clone() |
| 2725 | """ |
| 2726 | screen = self.screen |
| 2727 | self._newLine(self._drawing) |
| 2728 | |
| 2729 | turtle = self.turtle |
| 2730 | self.screen = None |
| 2731 | self.turtle = None # too make self deepcopy-able |
| 2732 | |
| 2733 | q = deepcopy(self) |
| 2734 | |
| 2735 | self.screen = screen |
| 2736 | self.turtle = turtle |
| 2737 | |
| 2738 | q.screen = screen |
| 2739 | q.turtle = _TurtleImage(screen, self.turtle.shapeIndex) |
| 2740 | |
| 2741 | screen._turtles.append(q) |
| 2742 | ttype = screen._shapes[self.turtle.shapeIndex]._type |
| 2743 | if ttype == "polygon": |
| 2744 | q.turtle._item = screen._createpoly() |
| 2745 | elif ttype == "image": |
| 2746 | q.turtle._item = screen._createimage(screen._shapes["blank"]._data) |
| 2747 | elif ttype == "compound": |
| 2748 | q.turtle._item = [screen._createpoly() for item in |
| 2749 | screen._shapes[self.turtle.shapeIndex]._data] |
| 2750 | q.currentLineItem = screen._createline() |
| 2751 | q._update() |
| 2752 | return q |
| 2753 | |
| 2754 | def shape(self, name=None): |
| 2755 | """Set turtle shape to shape with given name / return current shapename. |
nothing calls this directly
no test coverage detected