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)
| 2610 | return "#%02x%02x%02x" % (r, g, b) |
| 2611 | |
| 2612 | def clone(self): |
| 2613 | """Create and return a clone of the turtle. |
| 2614 | |
| 2615 | No argument. |
| 2616 | |
| 2617 | Create and return a clone of the turtle with same position, heading |
| 2618 | and turtle properties. |
| 2619 | |
| 2620 | Example (for a Turtle instance named mick): |
| 2621 | mick = Turtle() |
| 2622 | joe = mick.clone() |
| 2623 | """ |
| 2624 | screen = self.screen |
| 2625 | self._newLine(self._drawing) |
| 2626 | |
| 2627 | turtle = self.turtle |
| 2628 | self.screen = None |
| 2629 | self.turtle = None # too make self deepcopy-able |
| 2630 | |
| 2631 | q = deepcopy(self) |
| 2632 | |
| 2633 | self.screen = screen |
| 2634 | self.turtle = turtle |
| 2635 | |
| 2636 | q.screen = screen |
| 2637 | q.turtle = _TurtleImage(screen, self.turtle.shapeIndex) |
| 2638 | |
| 2639 | screen._turtles.append(q) |
| 2640 | ttype = screen._shapes[self.turtle.shapeIndex]._type |
| 2641 | if ttype == "polygon": |
| 2642 | q.turtle._item = screen._createpoly() |
| 2643 | elif ttype == "image": |
| 2644 | q.turtle._item = screen._createimage(screen._shapes["blank"]._data) |
| 2645 | elif ttype == "compound": |
| 2646 | q.turtle._item = [screen._createpoly() for item in |
| 2647 | screen._shapes[self.turtle.shapeIndex]._data] |
| 2648 | q.currentLineItem = screen._createline() |
| 2649 | q._update() |
| 2650 | return q |
| 2651 | |
| 2652 | def shape(self, name=None): |
| 2653 | """Set turtle shape to shape with given name / return current shapename. |
nothing calls this directly
no test coverage detected