mirror of
https://github.com/python/cpython.git
synced 2025-09-28 11:15:17 +00:00
gh-104679 Fixed syntax highlighting in turtle docs (#104682)
This commit is contained in:
parent
ff7f731632
commit
2c97878bb8
1 changed files with 83 additions and 83 deletions
|
@ -359,18 +359,18 @@ Turtle motion
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> tp = turtle.pos()
|
>>> tp = turtle.pos()
|
||||||
>>> tp
|
>>> tp
|
||||||
(0.00,0.00)
|
(0.00,0.00)
|
||||||
>>> turtle.setpos(60,30)
|
>>> turtle.setpos(60,30)
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(60.00,30.00)
|
(60.00,30.00)
|
||||||
>>> turtle.setpos((20,80))
|
>>> turtle.setpos((20,80))
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(20.00,80.00)
|
(20.00,80.00)
|
||||||
>>> turtle.setpos(tp)
|
>>> turtle.setpos(tp)
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(0.00,0.00)
|
(0.00,0.00)
|
||||||
|
|
||||||
|
|
||||||
.. function:: teleport(x, y=None, *, fill_gap=False)
|
.. function:: teleport(x, y=None, *, fill_gap=False)
|
||||||
|
@ -395,18 +395,18 @@ Turtle motion
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> tp = turtle.pos()
|
>>> tp = turtle.pos()
|
||||||
>>> tp
|
>>> tp
|
||||||
(0.00,0.00)
|
(0.00,0.00)
|
||||||
>>> turtle.teleport(60)
|
>>> turtle.teleport(60)
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(60.00,0.00)
|
(60.00,0.00)
|
||||||
>>> turtle.teleport(y=10)
|
>>> turtle.teleport(y=10)
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(60.00,10.00)
|
(60.00,10.00)
|
||||||
>>> turtle.teleport(20, 30)
|
>>> turtle.teleport(20, 30)
|
||||||
>>> turtle.pos()
|
>>> turtle.pos()
|
||||||
(20.00,30.00)
|
(20.00,30.00)
|
||||||
|
|
||||||
.. versionadded: 3.12
|
.. versionadded: 3.12
|
||||||
|
|
||||||
|
@ -950,23 +950,23 @@ Color control
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> colormode()
|
>>> colormode()
|
||||||
1.0
|
1.0
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
'red'
|
'red'
|
||||||
>>> turtle.pencolor("brown")
|
>>> turtle.pencolor("brown")
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
'brown'
|
'brown'
|
||||||
>>> tup = (0.2, 0.8, 0.55)
|
>>> tup = (0.2, 0.8, 0.55)
|
||||||
>>> turtle.pencolor(tup)
|
>>> turtle.pencolor(tup)
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
(0.2, 0.8, 0.5490196078431373)
|
(0.2, 0.8, 0.5490196078431373)
|
||||||
>>> colormode(255)
|
>>> colormode(255)
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
(51.0, 204.0, 140.0)
|
(51.0, 204.0, 140.0)
|
||||||
>>> turtle.pencolor('#32c18f')
|
>>> turtle.pencolor('#32c18f')
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
(50.0, 193.0, 143.0)
|
(50.0, 193.0, 143.0)
|
||||||
|
|
||||||
|
|
||||||
.. function:: fillcolor(*args)
|
.. function:: fillcolor(*args)
|
||||||
|
@ -999,17 +999,17 @@ Color control
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> turtle.fillcolor("violet")
|
>>> turtle.fillcolor("violet")
|
||||||
>>> turtle.fillcolor()
|
>>> turtle.fillcolor()
|
||||||
'violet'
|
'violet'
|
||||||
>>> turtle.pencolor()
|
>>> turtle.pencolor()
|
||||||
(50.0, 193.0, 143.0)
|
(50.0, 193.0, 143.0)
|
||||||
>>> turtle.fillcolor((50, 193, 143)) # Integers, not floats
|
>>> turtle.fillcolor((50, 193, 143)) # Integers, not floats
|
||||||
>>> turtle.fillcolor()
|
>>> turtle.fillcolor()
|
||||||
(50.0, 193.0, 143.0)
|
(50.0, 193.0, 143.0)
|
||||||
>>> turtle.fillcolor('#ffffff')
|
>>> turtle.fillcolor('#ffffff')
|
||||||
>>> turtle.fillcolor()
|
>>> turtle.fillcolor()
|
||||||
(255.0, 255.0, 255.0)
|
(255.0, 255.0, 255.0)
|
||||||
|
|
||||||
|
|
||||||
.. function:: color(*args)
|
.. function:: color(*args)
|
||||||
|
@ -1038,12 +1038,12 @@ Color control
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> turtle.color("red", "green")
|
>>> turtle.color("red", "green")
|
||||||
>>> turtle.color()
|
>>> turtle.color()
|
||||||
('red', 'green')
|
('red', 'green')
|
||||||
>>> color("#285078", "#a0c8f0")
|
>>> color("#285078", "#a0c8f0")
|
||||||
>>> color()
|
>>> color()
|
||||||
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))
|
||||||
|
|
||||||
|
|
||||||
See also: Screen method :func:`colormode`.
|
See also: Screen method :func:`colormode`.
|
||||||
|
@ -1065,11 +1065,11 @@ Filling
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> turtle.begin_fill()
|
>>> turtle.begin_fill()
|
||||||
>>> if turtle.filling():
|
>>> if turtle.filling():
|
||||||
... turtle.pensize(5)
|
... turtle.pensize(5)
|
||||||
... else:
|
... else:
|
||||||
... turtle.pensize(3)
|
... turtle.pensize(3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1275,11 +1275,11 @@ Appearance
|
||||||
.. doctest::
|
.. doctest::
|
||||||
:skipif: _tkinter is None
|
:skipif: _tkinter is None
|
||||||
|
|
||||||
>>> turtle.shape("circle")
|
>>> turtle.shape("circle")
|
||||||
>>> turtle.shapesize(5,2)
|
>>> turtle.shapesize(5,2)
|
||||||
>>> turtle.shearfactor(0.5)
|
>>> turtle.shearfactor(0.5)
|
||||||
>>> turtle.shearfactor()
|
>>> turtle.shearfactor()
|
||||||
0.5
|
0.5
|
||||||
|
|
||||||
|
|
||||||
.. function:: tilt(angle)
|
.. function:: tilt(angle)
|
||||||
|
@ -1648,11 +1648,11 @@ Window control
|
||||||
``"nopic"``, delete background image, if present. If *picname* is ``None``,
|
``"nopic"``, delete background image, if present. If *picname* is ``None``,
|
||||||
return the filename of the current backgroundimage. ::
|
return the filename of the current backgroundimage. ::
|
||||||
|
|
||||||
>>> screen.bgpic()
|
>>> screen.bgpic()
|
||||||
'nopic'
|
'nopic'
|
||||||
>>> screen.bgpic("landscape.gif")
|
>>> screen.bgpic("landscape.gif")
|
||||||
>>> screen.bgpic()
|
>>> screen.bgpic()
|
||||||
"landscape.gif"
|
"landscape.gif"
|
||||||
|
|
||||||
|
|
||||||
.. function:: clear()
|
.. function:: clear()
|
||||||
|
@ -2059,16 +2059,16 @@ Settings and special methods
|
||||||
|
|
||||||
Return the height of the turtle window. ::
|
Return the height of the turtle window. ::
|
||||||
|
|
||||||
>>> screen.window_height()
|
>>> screen.window_height()
|
||||||
480
|
480
|
||||||
|
|
||||||
|
|
||||||
.. function:: window_width()
|
.. function:: window_width()
|
||||||
|
|
||||||
Return the width of the turtle window. ::
|
Return the width of the turtle window. ::
|
||||||
|
|
||||||
>>> screen.window_width()
|
>>> screen.window_width()
|
||||||
640
|
640
|
||||||
|
|
||||||
|
|
||||||
.. _screenspecific:
|
.. _screenspecific:
|
||||||
|
@ -2249,12 +2249,12 @@ facilities:
|
||||||
in the range 0..colormode or a 3-tuple of such numbers.
|
in the range 0..colormode or a 3-tuple of such numbers.
|
||||||
|
|
||||||
|
|
||||||
>>> screen.bgcolor("orange")
|
>>> screen.bgcolor("orange")
|
||||||
>>> screen.bgcolor()
|
>>> screen.bgcolor()
|
||||||
"orange"
|
"orange"
|
||||||
>>> screen.bgcolor(0.5,0,0.5)
|
>>> screen.bgcolor(0.5,0,0.5)
|
||||||
>>> screen.bgcolor()
|
>>> screen.bgcolor()
|
||||||
"#800080"
|
"#800080"
|
||||||
|
|
||||||
>>> help(Turtle.penup)
|
>>> help(Turtle.penup)
|
||||||
Help on method penup in module turtle:
|
Help on method penup in module turtle:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue