Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a9615d14
Commit
a9615d14
authored
Oct 31, 2010
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issues #7061, #10225: Fixed doctests in turtle manual
parent
61d0d60e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
24 deletions
+21
-24
Doc/library/turtle.rst
Doc/library/turtle.rst
+21
-24
No files found.
Doc/library/turtle.rst
View file @
a9615d14
...
@@ -645,8 +645,8 @@ Tell Turtle's state
...
@@ -645,8 +645,8 @@ Tell Turtle's state
>>> turtle.forward(100)
>>> turtle.forward(100)
>>> turtle.pos()
>>> turtle.pos()
(64.28,76.60)
(64.28,76.60)
>>> print(
turtle.xcor(
))
>>> print(
round(turtle.xcor(), 5
))
64.27876
09687
64.27876
.. function:: ycor()
.. function:: ycor()
...
@@ -660,8 +660,8 @@ Tell Turtle's state
...
@@ -660,8 +660,8 @@ Tell Turtle's state
>>> turtle.forward(100)
>>> turtle.forward(100)
>>> print(turtle.pos())
>>> print(turtle.pos())
(50.00,86.60)
(50.00,86.60)
>>> print(
turtle.ycor(
))
>>> print(
round(turtle.ycor(), 5
))
86.60254
03784
86.60254
.. function:: heading()
.. function:: heading()
...
@@ -813,20 +813,16 @@ Drawing state
...
@@ -813,20 +813,16 @@ Drawing state
>>> sorted(turtle.pen().items())
>>> sorted(turtle.pen().items())
[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),
[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),
('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]
('shearfactor', 0.0), ('shown', True), ('speed', 9),
('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]
>>> penstate=turtle.pen()
>>> penstate=turtle.pen()
>>> turtle.color("yellow", "")
>>> turtle.color("yellow", "")
>>> turtle.penup()
>>> turtle.penup()
>>> sorted(turtle.pen().items())
>>> sorted(turtle.pen().items())[:3]
[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow'),
[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]
('pendown', False), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]
>>> turtle.pen(penstate, fillcolor="green")
>>> turtle.pen(penstate, fillcolor="green")
>>> sorted(turtle.pen().items())
>>> sorted(turtle.pen().items())[:3]
[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red'),
[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]
('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),
('shown', True), ('speed', 9), ('stretchfactor', (1, 1)), ('tilt', 0)]
.. function:: isdown()
.. function:: isdown()
...
@@ -887,10 +883,10 @@ Color control
...
@@ -887,10 +883,10 @@ Color control
(0.2, 0.8, 0.5490196078431373)
(0.2, 0.8, 0.5490196078431373)
>>> colormode(255)
>>> colormode(255)
>>> turtle.pencolor()
>>> turtle.pencolor()
(51
, 204, 14
0)
(51
.0, 204.0, 140.
0)
>>> turtle.pencolor('#32c18f')
>>> turtle.pencolor('#32c18f')
>>> turtle.pencolor()
>>> turtle.pencolor()
(50
, 193, 143
)
(50
.0, 193.0, 143.0
)
.. function:: fillcolor(*args)
.. function:: fillcolor(*args)
...
@@ -927,13 +923,13 @@ Color control
...
@@ -927,13 +923,13 @@ Color control
'violet'
'violet'
>>> col = turtle.pencolor()
>>> col = turtle.pencolor()
>>> col
>>> col
(50
, 193, 143
)
(50
.0, 193.0, 143.0
)
>>> turtle.fillcolor(col)
>>> turtle.fillcolor(col)
>>> turtle.fillcolor()
>>> turtle.fillcolor()
(50
, 193, 143
)
(50
.0, 193.0, 143.0
)
>>> turtle.fillcolor('#ffffff')
>>> turtle.fillcolor('#ffffff')
>>> turtle.fillcolor()
>>> turtle.fillcolor()
(255
, 255, 255
)
(255
.0, 255.0, 255.0
)
.. function:: color(*args)
.. function:: color(*args)
...
@@ -966,7 +962,7 @@ Color control
...
@@ -966,7 +962,7 @@ Color control
('red', 'green')
('red', 'green')
>>> color("#285078", "#a0c8f0")
>>> color("#285078", "#a0c8f0")
>>> color()
>>> color()
((40
, 80, 120), (160, 200, 24
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`.
...
@@ -1160,7 +1156,7 @@ Appearance
...
@@ -1160,7 +1156,7 @@ Appearance
.. doctest::
.. doctest::
>>> turtle.shapesize()
>>> turtle.shapesize()
(1
, 1
, 1)
(1
.0, 1.0
, 1)
>>> turtle.resizemode("user")
>>> turtle.resizemode("user")
>>> turtle.shapesize(5, 5, 12)
>>> turtle.shapesize(5, 5, 12)
>>> turtle.shapesize()
>>> turtle.shapesize()
...
@@ -1187,7 +1183,7 @@ Appearance
...
@@ -1187,7 +1183,7 @@ Appearance
>>> 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)
...
@@ -1271,11 +1267,12 @@ Appearance
...
@@ -1271,11 +1267,12 @@ Appearance
.. doctest::
.. doctest::
>>> turtle = Turtle()
>>> turtle.shape("square")
>>> turtle.shape("square")
>>> turtle.shapesize(4,2)
>>> turtle.shapesize(4,2)
>>> turtle.shearfactor(-0.5)
>>> turtle.shearfactor(-0.5)
>>> turtle.shapetransform()
>>> turtle.shapetransform()
>>>
(4.0, -1.0, -0.0, 2.0)
(4.0, -1.0, -0.0, 2.0)
.. function:: get_shapepoly()
.. function:: get_shapepoly()
...
@@ -1524,7 +1521,7 @@ Window control
...
@@ -1524,7 +1521,7 @@ Window control
'orange'
'orange'
>>> screen.bgcolor("#800080")
>>> screen.bgcolor("#800080")
>>> screen.bgcolor()
>>> screen.bgcolor()
(128
, 0, 128
)
(128
.0, 0.0, 128.0
)
.. function:: bgpic(picname=None)
.. function:: bgpic(picname=None)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment