:func:`Screen.numinput <numinput>`. These pop up input dialogs and return
strings and numbers respectively.
-- Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py`
- have been added to the :file:`Lib/turtledemo` directory.
-
.. doctest::
:skipif: _tkinter is None
-""" turtle-example-suite:
-
- tdemo_bytedesign.py
+"""turtledemo/bytedesign.py
An example adapted from the example-suite
of PythonCard's turtle graphics.
-# File: tdemo_chaos.py
-# Author: Gregor Lingl
-# Date: 2009-06-24
-
-# A demonstration of chaos
+"""turtledemo/chaos.py
+A demonstration of chaos.
+"""
from turtle import *
N = 80
-""" turtle-example-suite:
-
- turtledemo/clock.py
+"""turtledemo/clock.py
Enhanced clock-program, showing date
-and time
- ------------------------------------
- Press STOP to exit the program!
- ------------------------------------
+and time.
"""
from turtle import *
from datetime import datetime
-# colormixer
-
+"""turtledemo/colormixer.py"""
from turtle import Screen, Turtle, mainloop
class ColorTurtle(Turtle):
-""" turtlegraphics-example-suite:
+"""turtledemo/forest.py
- tdemo_forest.py
+Displays a 'forest' of 3 breadth-first trees,
+similar to the one in tree.py.
+For further details, see tree.py.
-Displays a 'forest' of 3 breadth-first-trees
-similar to the one in tree.
-For further remarks see tree.py
-
-This example is a 'breadth-first'-rewrite of
-a Logo program written by Erich Neuwirth. See
-http://homepage.univie.ac.at/erich.neuwirth/
+This example is a breadth-first rewrite of
+a Logo program by Erich Neuwirth.
"""
from turtle import Turtle, colormode, tracer, mainloop
from random import randrange
-""" turtle-example-suite:
-
- tdemo_fractalCurves.py
+"""turtledemo/fractalcurves.py
This program draws two fractal-curve-designs:
(1) A hilbert curve (in a box)
-""" turtle-example-suite:
-
- xtx_lindenmayer_indian.py
+"""turtledemo/lindenmayer.py
Each morning women in Tamil Nadu, in southern
India, place designs, created by using rice
-""" turtle-example-suite:
-
- tdemo_minimal_hanoi.py
+"""turtledemo/minimal_hanoi.py
A minimal 'Towers of Hanoi' animation:
A tower of 6 discs is transferred from the
Discs are turtles with shape "square", but
stretched to rectangles by shapesize()
- ---------------------------------------
- To exit press STOP button
- ---------------------------------------
"""
from turtle import *
-""" turtle-example-suite:
-
- tdemo_nim.py
+"""turtledemo/nim.py
Play nim against the computer. The player
who takes the last stick is the winner.
-""" turtle-example-suite:
+"""turtledemo/paint.py
- tdemo_paint.py
-
-A simple event-driven paint program
-
-- left mouse button moves turtle
-- middle mouse button changes color
-- right mouse button toggles between pen up
+A simple event-driven paint program.
+- Left mouse button moves turtle.
+- Middle mouse button changes color.
+- Right mouse button toggles between pen up
(no line drawn when the turtle moves) and
pen down (line is drawn). If pen up follows
at least two pen-down moves, the polygon that
-------------------------------------------
Play around by clicking into the canvas
using all three mouse buttons.
- -------------------------------------------
- To exit press STOP button
-------------------------------------------
"""
from turtle import *
-""" turtle-example-suite:
-
- tdemo_peace.py
+"""turtledemo/peace.py
A simple drawing suitable as a beginner's
programming example. Aside from the
-""" xturtle-example-suite:
-
- xtx_kites_and_darts.py
+"""turtledemo/penrose.py
Constructs two aperiodic penrose-tilings,
consisting of kites and darts, by the method
consisting of five darts.
For more information see:
- http://en.wikipedia.org/wiki/Penrose_tiling
+ https://en.wikipedia.org/wiki/Penrose_tiling
-------------------------------------------
"""
from turtle import *
-""" turtle-example-suite:
-
- tdemo_planets_and_moon.py
+"""turtledemo/planets_and_moon.py
Gravitational system simulation using the
approximation method from Feynman-lectures,
-""" turtle-example-suite:
-
- tdemo_wikipedia3.py
+"""turtledemo/rosette.py
This example is
inspired by the Wikipedia article on turtle
-""" turtle-example-suite:
-
- tdemo_round_dance.py
-
-(Needs version 1.1 of the turtle module that
-comes with Python 3.1)
+"""turtledemo/round_dance.py
Dancing turtles have a compound shape
consisting of a series of triangles of
-"""
-
- sorting_animation.py
+"""turtledemo/sorting_animation.py
A minimal sorting algorithm animation:
Sorts a shelf of 10 blocks using insertion
Blocks are turtles with shape "square", but
stretched to rectangles by shapesize()
- ---------------------------------------
- To exit press space button
- ---------------------------------------
"""
from turtle import *
import random
-""" turtle-example-suite:
-
- tdemo_tree.py
+"""turtledemo/tree.py
Displays a 'breadth-first-tree' - in contrast
to the classical Logo tree drawing programs,
-"""turtledemo.two_canvases
+"""turtledemo/two_canvases.py
Use TurtleScreen and RawTurtle to draw on two
distinct canvases in a separate window. The
-""" turtle-example-suite:
-
- tdemo_yinyang.py
+"""turtledemo/yinyang.py
Another drawing suitable as a beginner's
programming example.