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
ea13d9d8
Commit
ea13d9d8
authored
Nov 01, 2010
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10199: Moved Demo/turtle under Lib/
parent
8291af23
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
32 additions
and
481 deletions
+32
-481
Demo/turtle/tdemo_I_dontlike_tiltdemo.py
Demo/turtle/tdemo_I_dontlike_tiltdemo.py
+0
-58
Demo/turtle/tdemo_lindenmayer_indian.py
Demo/turtle/tdemo_lindenmayer_indian.py
+0
-119
Demo/turtle/turtleDemo.py
Demo/turtle/turtleDemo.py
+0
-291
Doc/library/turtle.rst
Doc/library/turtle.rst
+16
-9
Lib/test/test_dict.py
Lib/test/test_dict.py
+8
-0
Lib/turtledemo/__init__.py
Lib/turtledemo/__init__.py
+0
-0
Lib/turtledemo/about_turtle.txt
Lib/turtledemo/about_turtle.txt
+0
-0
Lib/turtledemo/about_turtledemo.txt
Lib/turtledemo/about_turtledemo.txt
+0
-0
Lib/turtledemo/bytedesign.py
Lib/turtledemo/bytedesign.py
+0
-0
Lib/turtledemo/chaos.py
Lib/turtledemo/chaos.py
+0
-0
Lib/turtledemo/clock.py
Lib/turtledemo/clock.py
+0
-0
Lib/turtledemo/colormixer.py
Lib/turtledemo/colormixer.py
+0
-0
Lib/turtledemo/demohelp.txt
Lib/turtledemo/demohelp.txt
+0
-0
Lib/turtledemo/forest.py
Lib/turtledemo/forest.py
+0
-0
Lib/turtledemo/fractalcurves.py
Lib/turtledemo/fractalcurves.py
+0
-0
Lib/turtledemo/minimal_hanoi.py
Lib/turtledemo/minimal_hanoi.py
+0
-0
Lib/turtledemo/nim.py
Lib/turtledemo/nim.py
+0
-0
Lib/turtledemo/paint.py
Lib/turtledemo/paint.py
+0
-0
Lib/turtledemo/peace.py
Lib/turtledemo/peace.py
+0
-0
Lib/turtledemo/penrose.py
Lib/turtledemo/penrose.py
+0
-0
Lib/turtledemo/planet_and_moon.py
Lib/turtledemo/planet_and_moon.py
+0
-0
Lib/turtledemo/round_dance.py
Lib/turtledemo/round_dance.py
+0
-0
Lib/turtledemo/tree.py
Lib/turtledemo/tree.py
+0
-0
Lib/turtledemo/turtle.cfg
Lib/turtledemo/turtle.cfg
+0
-0
Lib/turtledemo/two_canvases.py
Lib/turtledemo/two_canvases.py
+4
-4
Lib/turtledemo/wikipedia.py
Lib/turtledemo/wikipedia.py
+0
-0
Lib/turtledemo/yinyang.py
Lib/turtledemo/yinyang.py
+0
-0
Makefile.pre.in
Makefile.pre.in
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Demo/turtle/tdemo_I_dontlike_tiltdemo.py
deleted
100644 → 0
View file @
8291af23
#!/usr/bin/env python3
""" turtle-example-suite:
tdemo-I_dont_like_tiltdemo.py
Demostrates
(a) use of a tilted ellipse as
turtle shape
(b) stamping that shape
We can remove it, if you don't like it.
Without using reset() ;-)
---------------------------------------
"""
from
turtle
import
*
import
time
def
main
():
reset
()
shape
(
"circle"
)
resizemode
(
"user"
)
pu
();
bk
(
24
*
18
/
6.283
);
rt
(
90
);
pd
()
tilt
(
45
)
pu
()
turtlesize
(
16
,
10
,
5
)
color
(
"red"
,
"violet"
)
for
i
in
range
(
18
):
fd
(
24
)
lt
(
20
)
stamp
()
color
(
"red"
,
""
)
for
i
in
range
(
18
):
fd
(
24
)
lt
(
20
)
stamp
()
tilt
(
-
15
)
turtlesize
(
3
,
1
,
4
)
color
(
"blue"
,
"yellow"
)
for
i
in
range
(
17
):
fd
(
24
)
lt
(
20
)
if
i
%
2
==
0
:
stamp
()
time
.
sleep
(
1
)
while
undobufferentries
():
undo
()
ht
()
write
(
"OK, OVER!"
,
align
=
"center"
,
font
=
(
"Courier"
,
18
,
"bold"
))
return
"Done!"
if
__name__
==
"__main__"
:
msg
=
main
()
print
(
msg
)
# mainloop()
Demo/turtle/tdemo_lindenmayer_indian.py
deleted
100644 → 0
View file @
8291af23
#!/usr/bin/env python3
""" turtle-example-suite:
xtx_lindenmayer_indian.py
Each morning women in Tamil Nadu, in southern
India, place designs, created by using rice
flour and known as kolam on the thresholds of
their homes.
These can be described by Lindenmayer systems,
which can easily be implemented with turtle
graphics and Python.
Two examples are shown here:
(1) the snake kolam
(2) anklets of Krishna
Taken from Marcia Ascher: Mathematics
Elsewhere, An Exploration of Ideas Across
Cultures
"""
################################
# Mini Lindenmayer tool
###############################
from
turtle
import
*
def
replace
(
seq
,
replacementRules
,
n
):
for
i
in
range
(
n
):
newseq
=
""
for
element
in
seq
:
newseq
=
newseq
+
replacementRules
.
get
(
element
,
element
)
seq
=
newseq
return
seq
def
draw
(
commands
,
rules
):
for
b
in
commands
:
try
:
rules
[
b
]()
except
TypeError
:
try
:
draw
(
rules
[
b
],
rules
)
except
:
pass
def
main
():
################################
# Example 1: Snake kolam
################################
def
r
():
right
(
45
)
def
l
():
left
(
45
)
def
f
():
forward
(
7.5
)
snake_rules
=
{
"-"
:
r
,
"+"
:
l
,
"f"
:
f
,
"b"
:
"f+f+f--f--f+f+f"
}
snake_replacementRules
=
{
"b"
:
"b+f+b--f--b+f+b"
}
snake_start
=
"b--f--b--f"
drawing
=
replace
(
snake_start
,
snake_replacementRules
,
3
)
reset
()
speed
(
3
)
tracer
(
1
,
0
)
ht
()
up
()
backward
(
195
)
down
()
draw
(
drawing
,
snake_rules
)
from
time
import
sleep
sleep
(
3
)
################################
# Example 2: Anklets of Krishna
################################
def
A
():
color
(
"red"
)
circle
(
10
,
90
)
def
B
():
from
math
import
sqrt
color
(
"black"
)
l
=
5
/
sqrt
(
2
)
forward
(
l
)
circle
(
l
,
270
)
forward
(
l
)
def
F
():
color
(
"green"
)
forward
(
10
)
krishna_rules
=
{
"a"
:
A
,
"b"
:
B
,
"f"
:
F
}
krishna_replacementRules
=
{
"a"
:
"afbfa"
,
"b"
:
"afbfbfbfa"
}
krishna_start
=
"fbfbfbfb"
reset
()
speed
(
0
)
tracer
(
3
,
0
)
ht
()
left
(
45
)
drawing
=
replace
(
krishna_start
,
krishna_replacementRules
,
3
)
draw
(
drawing
,
krishna_rules
)
tracer
(
1
)
return
"Done!"
if
__name__
==
'__main__'
:
msg
=
main
()
print
(
msg
)
mainloop
()
Demo/turtle/turtleDemo.py
deleted
100644 → 0
View file @
8291af23
This diff is collapsed.
Click to expand it.
Doc/library/turtle.rst
View file @
ea13d9d8
...
...
@@ -2266,29 +2266,36 @@ not from within the demo-viewer).
Demo scripts
============
There is a set of demo scripts in the
turtledemo directory located in th
e
:file:`Demo/turtle` directory in the source distribution.
There is a set of demo scripts in the
:mod:`turtledemo` package. Thes
e
scripts can be run and viewed using the supplied demo viewer as follows::
It contains:
python -m turtledemo
Alternatively, you can run the demo scripts individually. For example,
::
python -m turtledemo.bytedesign
The :mod:`turtledemo` package directory contains:
- a set of 15 demo scripts demonstrating different features of the new module
:mod:`turtle`
- a demo viewer :file:`
turtleDemo
.py` which can be used to view the sourcecode
:mod:`turtle`
;
- a demo viewer :file:`
__main__
.py` which can be used to view the sourcecode
of the scripts and run them at the same time. 14 of the examples can be
accessed via the Examples menu; all of them can also be run standalone.
- The example :
file:`turtledemo_two_canvases.py
` demonstrates the simultaneous
- The example :
mod:`turtledemo.two_canvases
` demonstrates the simultaneous
use of two canvases with the turtle module. Therefore it only can be run
standalone.
- There is a :file:`turtle.cfg` file in this directory, which
also
serves as an
- There is a :file:`turtle.cfg` file in this directory, which serves as an
example for how to write and use such files.
The demoscripts are:
The demo
scripts are:
+----------------+------------------------------+-----------------------+
| Name | Description | Features |
+----------------+------------------------------+-----------------------+
| bytedesign | complex classical | :func:`tracer`, delay,|
| | turtle
graphics pattern
| :func:`update` |
| | turtle
graphics pattern
| :func:`update` |
+----------------+------------------------------+-----------------------+
| chaos | graphs verhust dynamics, | world coordinates |
| | proves that you must not | |
...
...
Lib/test/test_dict.py
View file @
ea13d9d8
...
...
@@ -329,11 +329,19 @@ class DictTest(unittest.TestCase):
k
,
v
=
'abc'
,
'def'
d
[
k
]
=
v
self
.
assertRaises
(
KeyError
,
d
.
pop
,
'ghi'
)
try
:
d
.
pop
(
'ghi'
)
except
KeyError
as
e
:
self
.
assertEquals
(
e
.
args
[
0
],
'ghi'
)
self
.
assertEqual
(
d
.
pop
(
k
),
v
)
self
.
assertEqual
(
len
(
d
),
0
)
self
.
assertRaises
(
KeyError
,
d
.
pop
,
k
)
try
:
d
.
pop
(
k
)
except
KeyError
as
e
:
self
.
assertEquals
(
e
.
args
[
0
],
k
)
self
.
assertEqual
(
d
.
pop
(
k
,
v
),
v
)
d
[
k
]
=
v
...
...
Lib/turtledemo/__init__.py
0 → 100644
View file @
ea13d9d8
Demo/turtle
/about_turtle.txt
→
Lib/turtledemo
/about_turtle.txt
View file @
ea13d9d8
File moved
Demo/turtle
/about_turtledemo.txt
→
Lib/turtledemo
/about_turtledemo.txt
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
bytedesign.py
→
Lib/turtledemo/
bytedesign.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
chaos.py
→
Lib/turtledemo/
chaos.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
clock.py
→
Lib/turtledemo/
clock.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
colormixer.py
→
Lib/turtledemo/
colormixer.py
View file @
ea13d9d8
File moved
Demo/turtle
/demohelp.txt
→
Lib/turtledemo
/demohelp.txt
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
forest.py
→
Lib/turtledemo/
forest.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
fractalcurves.py
→
Lib/turtledemo/
fractalcurves.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
minimal_hanoi.py
→
Lib/turtledemo/
minimal_hanoi.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
nim.py
→
Lib/turtledemo/
nim.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
paint.py
→
Lib/turtledemo/
paint.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
peace.py
→
Lib/turtledemo/
peace.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
penrose.py
→
Lib/turtledemo/
penrose.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
planet_and_moon.py
→
Lib/turtledemo/
planet_and_moon.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
round_dance.py
→
Lib/turtledemo/
round_dance.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
tree.py
→
Lib/turtledemo/
tree.py
View file @
ea13d9d8
File moved
Demo/turtle
/turtle.cfg
→
Lib/turtledemo
/turtle.cfg
View file @
ea13d9d8
File moved
Demo/turtle/turtledemo_
two_canvases.py
→
Lib/turtledemo/
two_canvases.py
View file @
ea13d9d8
...
...
@@ -44,9 +44,9 @@ for t in p,q:
## Want to get some info?
print
(
s1
,
s2
)
print
(
p
,
q
)
print
(
s1
.
turtles
())
print
(
s2
.
turtles
())
#
print(s1, s2)
#
print(p, q)
#
print(s1.turtles())
#
print(s2.turtles())
TK
.
mainloop
()
Demo/turtle/tdemo_
wikipedia.py
→
Lib/turtledemo/
wikipedia.py
View file @
ea13d9d8
File moved
Demo/turtle/tdemo_
yinyang.py
→
Lib/turtledemo/
yinyang.py
View file @
ea13d9d8
File moved
Makefile.pre.in
View file @
ea13d9d8
...
...
@@ -893,6 +893,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
importlib/test/extension importlib/test/frozen
\
importlib/test/import_ importlib/test/source
\
setuptools setuptools/command setuptools/tests setuptools.egg-info
\
turtledemo
\
multiprocessing multiprocessing/dummy
\
unittest unittest/test
\
curses pydoc_data
$(MACHDEPS)
...
...
Misc/NEWS
View file @
ea13d9d8
...
...
@@ -59,6 +59,9 @@ Core and Builtins
Library
-------
- Issue #10199: New package, ``turtledemo`` now contains selected demo
scripts that were formerly found under Demo/turtle.
- Issue #10265: Close file objects explicitly in sunau. Patch by Brian Brazil.
- Issue #10266: uu.decode didn't close in_file explicitly when it was given
...
...
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