1010**Source code: ** :source: `Lib/turtle.py `
1111
1212.. testsetup :: default
13+ :skipif: _tkinter is None
1314
1415 from turtle import *
1516 turtle = Turtle()
@@ -471,6 +472,7 @@ Turtle motion
471472 turtle is headed. Do not change the turtle's heading.
472473
473474 .. doctest ::
475+ :skipif: _tkinter is None
474476 :hide:
475477
476478 >>> turtle.goto(0 , 0 )
@@ -809,6 +811,7 @@ Turtle motion
809811 last *n * stamps.
810812
811813 .. doctest ::
814+ :skipif: _tkinter is None
812815
813816 >>> for i in range (8 ):
814817 ... unused_stamp_id = turtle.stamp()
@@ -1336,8 +1339,11 @@ More drawing control
13361339 font. If *move * is true, the pen is moved to the bottom-right corner of the
13371340 text. By default, *move * is ``False ``.
13381341
1339- >>> turtle.write(" Home = " , True , align = " center" )
1340- >>> turtle.write((0 ,0 ), True )
1342+ .. doctest ::
1343+ :skipif: _tkinter is None
1344+
1345+ >>> turtle.write(" Home = " , True , align = " center" )
1346+ >>> turtle.write((0 ,0 ), True )
13411347
13421348
13431349Turtle state
@@ -1374,12 +1380,15 @@ Visibility
13741380
13751381 Return ``True `` if the Turtle is shown, ``False `` if it's hidden.
13761382
1377- >>> turtle.hideturtle()
1378- >>> turtle.isvisible()
1379- False
1380- >>> turtle.showturtle()
1381- >>> turtle.isvisible()
1382- True
1383+ .. doctest ::
1384+ :skipif: _tkinter is None
1385+
1386+ >>> turtle.hideturtle()
1387+ >>> turtle.isvisible()
1388+ False
1389+ >>> turtle.showturtle()
1390+ >>> turtle.isvisible()
1391+ True
13831392
13841393
13851394Appearance
@@ -1822,7 +1831,10 @@ Window control
18221831 Set background image or return name of current backgroundimage. If *picname *
18231832 is a filename, set the corresponding image as background. If *picname * is
18241833 ``"nopic" ``, delete background image, if present. If *picname * is ``None ``,
1825- return the filename of the current backgroundimage. ::
1834+ return the filename of the current backgroundimage.
1835+
1836+ .. doctest ::
1837+ :skipif: True
18261838
18271839 >>> screen.bgpic()
18281840 'nopic'
@@ -1873,6 +1885,9 @@ Window control
18731885 method, one can make visible those parts of a drawing which were outside the
18741886 canvas before.
18751887
1888+ .. doctest ::
1889+ :skipif: _tkinter is None
1890+
18761891 >>> screen.screensize()
18771892 (400, 300)
18781893 >>> screen.screensize(2000 ,1500 )
@@ -2089,7 +2104,10 @@ Input methods
20892104 Pop up a dialog window for input of a string. Parameter title is
20902105 the title of the dialog window, prompt is a text mostly describing
20912106 what information to input.
2092- Return the string input. If the dialog is canceled, return ``None ``. ::
2107+ Return the string input. If the dialog is canceled, return ``None ``.
2108+
2109+ .. doctest ::
2110+ :skipif: True
20932111
20942112 >>> screen.textinput(" NIM" , " Name of first player:" )
20952113
@@ -2109,7 +2127,10 @@ Input methods
21092127 The number input must be in the range minval .. maxval if these are
21102128 given. If not, a hint is issued and the dialog remains open for
21112129 correction.
2112- Return the number input. If the dialog is canceled, return ``None ``. ::
2130+ Return the number input. If the dialog is canceled, return ``None ``.
2131+
2132+ .. doctest ::
2133+ :skipif: True
21132134
21142135 >>> screen.numinput(" Poker" , " Your stakes:" , 1000 , minval = 10 , maxval = 10000 )
21152136
@@ -2197,9 +2218,12 @@ Settings and special methods
21972218 There are three different ways to call this function:
21982219
21992220 (1) *name * is the name of a gif-file and *shape * is ``None ``: Install the
2200- corresponding image shape. ::
2221+ corresponding image shape.
22012222
2202- >>> screen.register_shape(" turtle.gif" )
2223+ .. doctest ::
2224+ :skipif: True
2225+
2226+ >>> screen.register_shape(" turtle.gif" )
22032227
22042228 .. note ::
22052229 Image shapes *do not * rotate when turning the turtle, so they do not
@@ -2233,15 +2257,21 @@ Settings and special methods
22332257
22342258.. function :: window_height()
22352259
2236- Return the height of the turtle window. ::
2260+ Return the height of the turtle window.
2261+
2262+ .. doctest ::
2263+ :skipif: True
22372264
22382265 >>> screen.window_height()
22392266 480
22402267
22412268
22422269.. function :: window_width()
22432270
2244- Return the width of the turtle window. ::
2271+ Return the width of the turtle window.
2272+
2273+ .. doctest ::
2274+ :skipif: True
22452275
22462276 >>> screen.window_width()
22472277 640
@@ -2448,7 +2478,10 @@ facilities:
24482478- When using IDLE, tooltips show the signatures and first lines of the
24492479 docstrings of typed in function-/method calls.
24502480
2451- - Calling :func: `help ` on methods or functions displays the docstrings::
2481+ - Calling :func: `help ` on methods or functions displays the docstrings:
2482+
2483+ .. doctest ::
2484+ :skipif: _tkinter is None
24522485
24532486 >>> help (Screen.bgcolor)
24542487 Help on method bgcolor in module turtle:
@@ -2480,7 +2513,10 @@ facilities:
24802513 >>> turtle.penup()
24812514
24822515- The docstrings of the functions which are derived from methods have a modified
2483- form::
2516+ form:
2517+
2518+ .. doctest ::
2519+ :skipif: _tkinter is None
24842520
24852521 >>> help (bgcolor)
24862522 Help on function bgcolor in module turtle:
0 commit comments