Move turtle to an absolute position. Aliases: setpos | setposition | goto: Arguments: x -- a number or a pair/vector of numbers y -- a number None call: goto(x, y) # two coordinates --or: goto((x, y)) # a
(self, x, y=None)
| 1742 | |
| 1743 | |
| 1744 | def goto(self, x, y=None): |
| 1745 | """Move turtle to an absolute position. |
| 1746 | |
| 1747 | Aliases: setpos | setposition | goto: |
| 1748 | |
| 1749 | Arguments: |
| 1750 | x -- a number or a pair/vector of numbers |
| 1751 | y -- a number None |
| 1752 | |
| 1753 | call: goto(x, y) # two coordinates |
| 1754 | --or: goto((x, y)) # a pair (tuple) of coordinates |
| 1755 | --or: goto(vec) # e.g. as returned by pos() |
| 1756 | |
| 1757 | Move turtle to an absolute position. If the pen is down, |
| 1758 | a line will be drawn. The turtle's orientation does not change. |
| 1759 | |
| 1760 | Example (for a Turtle instance named turtle): |
| 1761 | >>> tp = turtle.pos() |
| 1762 | >>> tp |
| 1763 | (0.00, 0.00) |
| 1764 | >>> turtle.setpos(60,30) |
| 1765 | >>> turtle.pos() |
| 1766 | (60.00,30.00) |
| 1767 | >>> turtle.setpos((20,80)) |
| 1768 | >>> turtle.pos() |
| 1769 | (20.00,80.00) |
| 1770 | >>> turtle.setpos(tp) |
| 1771 | >>> turtle.pos() |
| 1772 | (0.00,0.00) |
| 1773 | """ |
| 1774 | if y is None: |
| 1775 | self._goto(Vec2D(*x)) |
| 1776 | else: |
| 1777 | self._goto(Vec2D(x, y)) |
| 1778 | |
| 1779 | def home(self): |
| 1780 | """Move turtle to the origin - coordinates (0,0). |