MCPcopy Index your code
hub / github.com/python/cpython / goto

Method goto

Lib/turtle.py:1811–1844  ·  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 pair (tup

(self, x, y=None)

Source from the content-addressed store, hash-verified

1809
1810
1811 def goto(self, x, y=None):
1812 """Move turtle to an absolute position.
1813
1814 Aliases: setpos | setposition | goto:
1815
1816 Arguments:
1817 x -- a number or a pair/vector of numbers
1818 y -- a number None
1819
1820 call: goto(x, y) # two coordinates
1821 --or: goto((x, y)) # a pair (tuple) of coordinates
1822 --or: goto(vec) # e.g. as returned by pos()
1823
1824 Move turtle to an absolute position. If the pen is down,
1825 a line will be drawn. The turtle's orientation does not change.
1826
1827 Example (for a Turtle instance named turtle):
1828 >>> tp = turtle.pos()
1829 >>> tp
1830 (0.00,0.00)
1831 >>> turtle.setpos(60,30)
1832 >>> turtle.pos()
1833 (60.00,30.00)
1834 >>> turtle.setpos((20,80))
1835 >>> turtle.pos()
1836 (20.00,80.00)
1837 >>> turtle.setpos(tp)
1838 >>> turtle.pos()
1839 (0.00,0.00)
1840 """
1841 if y is None:
1842 self._goto(Vec2D(*x))
1843 else:
1844 self._goto(Vec2D(x, y))
1845
1846 def home(self):
1847 """Move turtle to the origin - coordinates (0,0).

Callers 13

homeMethod · 0.95
index.spec.tsFile · 0.80
demo2Function · 0.80
test_gotoMethod · 0.80
test_posMethod · 0.80
test_resetMethod · 0.80
designMethod · 0.80
tripieceMethod · 0.80
pentpieceMethod · 0.80
__init__Method · 0.80
mainFunction · 0.80
__init__Method · 0.80

Calls 2

_gotoMethod · 0.95
Vec2DClass · 0.70

Tested by 3

test_gotoMethod · 0.64
test_posMethod · 0.64
test_resetMethod · 0.64