mirror of https://github.com/python/cpython.git
[3.11] gh-104679 Fixed syntax highlighting in turtle docs (GH-104682). (#104695)
(cherry picked from commit 2c97878bb8
)
This commit is contained in:
parent
795b20e2f1
commit
89bd454cd9
|
@ -358,18 +358,18 @@ Turtle motion
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> tp = turtle.pos()
|
||||
>>> tp
|
||||
(0.00,0.00)
|
||||
>>> turtle.setpos(60,30)
|
||||
>>> turtle.pos()
|
||||
(60.00,30.00)
|
||||
>>> turtle.setpos((20,80))
|
||||
>>> turtle.pos()
|
||||
(20.00,80.00)
|
||||
>>> turtle.setpos(tp)
|
||||
>>> turtle.pos()
|
||||
(0.00,0.00)
|
||||
>>> tp = turtle.pos()
|
||||
>>> tp
|
||||
(0.00,0.00)
|
||||
>>> turtle.setpos(60,30)
|
||||
>>> turtle.pos()
|
||||
(60.00,30.00)
|
||||
>>> turtle.setpos((20,80))
|
||||
>>> turtle.pos()
|
||||
(20.00,80.00)
|
||||
>>> turtle.setpos(tp)
|
||||
>>> turtle.pos()
|
||||
(0.00,0.00)
|
||||
|
||||
|
||||
.. function:: setx(x)
|
||||
|
@ -919,23 +919,23 @@ Color control
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> colormode()
|
||||
1.0
|
||||
>>> turtle.pencolor()
|
||||
'red'
|
||||
>>> turtle.pencolor("brown")
|
||||
>>> turtle.pencolor()
|
||||
'brown'
|
||||
>>> tup = (0.2, 0.8, 0.55)
|
||||
>>> turtle.pencolor(tup)
|
||||
>>> turtle.pencolor()
|
||||
(0.2, 0.8, 0.5490196078431373)
|
||||
>>> colormode(255)
|
||||
>>> turtle.pencolor()
|
||||
(51.0, 204.0, 140.0)
|
||||
>>> turtle.pencolor('#32c18f')
|
||||
>>> turtle.pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
>>> colormode()
|
||||
1.0
|
||||
>>> turtle.pencolor()
|
||||
'red'
|
||||
>>> turtle.pencolor("brown")
|
||||
>>> turtle.pencolor()
|
||||
'brown'
|
||||
>>> tup = (0.2, 0.8, 0.55)
|
||||
>>> turtle.pencolor(tup)
|
||||
>>> turtle.pencolor()
|
||||
(0.2, 0.8, 0.5490196078431373)
|
||||
>>> colormode(255)
|
||||
>>> turtle.pencolor()
|
||||
(51.0, 204.0, 140.0)
|
||||
>>> turtle.pencolor('#32c18f')
|
||||
>>> turtle.pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
|
||||
|
||||
.. function:: fillcolor(*args)
|
||||
|
@ -968,17 +968,17 @@ Color control
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> turtle.fillcolor("violet")
|
||||
>>> turtle.fillcolor()
|
||||
'violet'
|
||||
>>> turtle.pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
>>> turtle.fillcolor((50, 193, 143)) # Integers, not floats
|
||||
>>> turtle.fillcolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
>>> turtle.fillcolor('#ffffff')
|
||||
>>> turtle.fillcolor()
|
||||
(255.0, 255.0, 255.0)
|
||||
>>> turtle.fillcolor("violet")
|
||||
>>> turtle.fillcolor()
|
||||
'violet'
|
||||
>>> turtle.pencolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
>>> turtle.fillcolor((50, 193, 143)) # Integers, not floats
|
||||
>>> turtle.fillcolor()
|
||||
(50.0, 193.0, 143.0)
|
||||
>>> turtle.fillcolor('#ffffff')
|
||||
>>> turtle.fillcolor()
|
||||
(255.0, 255.0, 255.0)
|
||||
|
||||
|
||||
.. function:: color(*args)
|
||||
|
@ -1007,12 +1007,12 @@ Color control
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> turtle.color("red", "green")
|
||||
>>> turtle.color()
|
||||
('red', 'green')
|
||||
>>> color("#285078", "#a0c8f0")
|
||||
>>> color()
|
||||
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
||||
>>> turtle.color("red", "green")
|
||||
>>> turtle.color()
|
||||
('red', 'green')
|
||||
>>> color("#285078", "#a0c8f0")
|
||||
>>> color()
|
||||
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
||||
|
||||
|
||||
See also: Screen method :func:`colormode`.
|
||||
|
@ -1034,11 +1034,11 @@ Filling
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> turtle.begin_fill()
|
||||
>>> if turtle.filling():
|
||||
... turtle.pensize(5)
|
||||
... else:
|
||||
... turtle.pensize(3)
|
||||
>>> turtle.begin_fill()
|
||||
>>> if turtle.filling():
|
||||
... turtle.pensize(5)
|
||||
... else:
|
||||
... turtle.pensize(3)
|
||||
|
||||
|
||||
|
||||
|
@ -1244,11 +1244,11 @@ Appearance
|
|||
.. doctest::
|
||||
:skipif: _tkinter is None
|
||||
|
||||
>>> turtle.shape("circle")
|
||||
>>> turtle.shapesize(5,2)
|
||||
>>> turtle.shearfactor(0.5)
|
||||
>>> turtle.shearfactor()
|
||||
0.5
|
||||
>>> turtle.shape("circle")
|
||||
>>> turtle.shapesize(5,2)
|
||||
>>> turtle.shearfactor(0.5)
|
||||
>>> turtle.shearfactor()
|
||||
0.5
|
||||
|
||||
|
||||
.. function:: tilt(angle)
|
||||
|
@ -1617,11 +1617,11 @@ Window control
|
|||
``"nopic"``, delete background image, if present. If *picname* is ``None``,
|
||||
return the filename of the current backgroundimage. ::
|
||||
|
||||
>>> screen.bgpic()
|
||||
'nopic'
|
||||
>>> screen.bgpic("landscape.gif")
|
||||
>>> screen.bgpic()
|
||||
"landscape.gif"
|
||||
>>> screen.bgpic()
|
||||
'nopic'
|
||||
>>> screen.bgpic("landscape.gif")
|
||||
>>> screen.bgpic()
|
||||
"landscape.gif"
|
||||
|
||||
|
||||
.. function:: clear()
|
||||
|
@ -2028,16 +2028,16 @@ Settings and special methods
|
|||
|
||||
Return the height of the turtle window. ::
|
||||
|
||||
>>> screen.window_height()
|
||||
480
|
||||
>>> screen.window_height()
|
||||
480
|
||||
|
||||
|
||||
.. function:: window_width()
|
||||
|
||||
Return the width of the turtle window. ::
|
||||
|
||||
>>> screen.window_width()
|
||||
640
|
||||
>>> screen.window_width()
|
||||
640
|
||||
|
||||
|
||||
.. _screenspecific:
|
||||
|
@ -2218,12 +2218,12 @@ facilities:
|
|||
in the range 0..colormode or a 3-tuple of such numbers.
|
||||
|
||||
|
||||
>>> screen.bgcolor("orange")
|
||||
>>> screen.bgcolor()
|
||||
"orange"
|
||||
>>> screen.bgcolor(0.5,0,0.5)
|
||||
>>> screen.bgcolor()
|
||||
"#800080"
|
||||
>>> screen.bgcolor("orange")
|
||||
>>> screen.bgcolor()
|
||||
"orange"
|
||||
>>> screen.bgcolor(0.5,0,0.5)
|
||||
>>> screen.bgcolor()
|
||||
"#800080"
|
||||
|
||||
>>> help(Turtle.penup)
|
||||
Help on method penup in module turtle:
|
||||
|
|
Loading…
Reference in New Issue