Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8a9681

Browse files
committed
Teleport documentation in Doc/library/turtle.rst
1 parent 01dd697 commit f8a9681

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Doc/library/turtle.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Turtle motion
107107
| :func:`right` | :func:`rt`
108108
| :func:`left` | :func:`lt`
109109
| :func:`goto` | :func:`setpos` | :func:`setposition`
110+
| :func:`teleport`
110111
| :func:`setx`
111112
| :func:`sety`
112113
| :func:`setheading` | :func:`seth`
@@ -372,6 +373,44 @@ Turtle motion
372373
(0.00,0.00)
373374

374375

376+
.. function:: teleport(x, y=None)
377+
378+
:param x: a number or ``None``
379+
:param y: a number or ``None``
380+
:param fill_gap: a boolean
381+
382+
Move turtle to an absolute position. Unlike goto(x, y), a line will not
383+
be drawn. The turtle's orientation does not change. If currently
384+
filling, the polygon(s) teleported from will be filled after leaving,
385+
and filling will begin again after teleporting. This can be disabled
386+
with fill_gap=True, which makes the imaginary line traveled during
387+
teleporting act as a fill barrier like in goto(x, y).
388+
389+
.. doctest::
390+
:skipif: _tkinter is None
391+
:hide:
392+
393+
>>> turtle.goto(0, 0)
394+
395+
.. doctest::
396+
:skipif: _tkinter is None
397+
398+
>>> tp = turtle.pos()
399+
>>> tp
400+
(0.00, 0.00)
401+
>>> turtle.teleport(60)
402+
>>> turtle.pos()
403+
(60.00,0.00)
404+
>>> turtle.teleport(y=10)
405+
>>> turtle.pos()
406+
(60.00,10.00)
407+
>>> turtle.teleport(20, 30)
408+
>>> turtle.pos()
409+
(20.00,30.00)
410+
411+
.. versionadded: 3.12
412+
413+
375414
.. function:: setx(x)
376415

377416
:param x: a number (integer or float)

0 commit comments

Comments
 (0)