镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions Doc/library/turtle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
**Source code:** :source:`Lib/turtle.py`

.. testsetup:: default
:skipif: _tkinter is None

from turtle import *
turtle = Turtle()

.. testcleanup::
:skipif: _tkinter is None

import os
os.remove("my_drawing.ps")
Expand Down Expand Up @@ -510,6 +512,7 @@ Turtle motion
turtle is headed. Do not change the turtle's heading.

.. doctest::
:skipif: _tkinter is None
:hide:

>>> turtle.goto(0, 0)
Expand Down Expand Up @@ -852,6 +855,7 @@ Turtle motion
last *n* stamps.

.. doctest::
:skipif: _tkinter is None

>>> for i in range(8):
... unused_stamp_id = turtle.stamp()
Expand Down Expand Up @@ -1409,8 +1413,11 @@ More drawing control
font. If *move* is true, the pen is moved to the bottom-right corner of the
text. By default, *move* is ``False``.

>>> turtle.write("Home = ", True, align="center")
>>> turtle.write((0,0), True)
.. doctest::
:skipif: _tkinter is None

>>> turtle.write("Home = ", True, align="center")
>>> turtle.write((0,0), True)


Turtle state
Expand Down Expand Up @@ -1447,12 +1454,15 @@ Visibility

Return ``True`` if the Turtle is shown, ``False`` if it's hidden.

>>> turtle.hideturtle()
>>> turtle.isvisible()
False
>>> turtle.showturtle()
>>> turtle.isvisible()
True
.. doctest::
:skipif: _tkinter is None

>>> turtle.hideturtle()
>>> turtle.isvisible()
False
>>> turtle.showturtle()
>>> turtle.isvisible()
True


Appearance
Expand Down Expand Up @@ -1983,6 +1993,9 @@ Window control
method, one can make visible those parts of a drawing which were outside the
canvas before.

.. doctest::
:skipif: _tkinter is None

>>> screen.screensize()
(400, 300)
>>> screen.screensize(2000,1500)
Expand Down
Loading