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

Method goto

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

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)

Source from the content-addressed store, hash-verified

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).

Callers 9

homeMethod · 0.95
demo2Function · 0.80
designMethod · 0.80
tripieceMethod · 0.80
pentpieceMethod · 0.80
__init__Method · 0.80
mainFunction · 0.80
__init__Method · 0.80
displayMethod · 0.80

Calls 2

_gotoMethod · 0.95
Vec2DClass · 0.85

Tested by

no test coverage detected