PageRenderTime 565ms CodeModel.GetById 463ms app.highlight 1ms RepoModel.GetById 99ms app.codeStats 0ms

Plain Text | 77 lines | 56 code | 21 blank | 0 comment | 0 complexity | 147b4431a08f954d4acec59e027149f0 MD5 | raw file
 3                       A new turtle module for Python
 6Turtle graphics is a popular way for introducing programming to
 7kids. It was part of the original Logo programming language developed
 8by Wally Feurzig and Seymour Papert in 1966.
10Imagine a robotic turtle starting at (0, 0) in the x-y plane. Give it
11the command turtle.forward(15), and it moves (on-screen!) 15 pixels in
12the direction it is facing, drawing a line as it moves. Give it the
13command turtle.left(25), and it rotates in-place 25 degrees clockwise.
15By combining together these and similar commands, intricate shapes and
16pictures can easily be drawn.
20This module is an extended reimplementation of from the
21Python standard distribution up to Python 2.5. (See: http:\\
23It tries to keep the merits of and to be (nearly) 100%
24compatible with it. This means in the first place to enable the
25learning programmer to use all the commands, classes and methods
26interactively when using the module from within IDLE run with
27the -n switch.
29Roughly it has the following features added:
31- Better animation of the turtle movements, especially of turning the
32  turtle. So the turtles can more easily be used as a visual feedback
33  instrument by the (beginning) programmer.
35- Different turtle shapes, gif-images as turtle shapes, user defined
36  and user controllable turtle shapes, among them compound
37  (multicolored) shapes. Turtle shapes can be stgretched and tilted, which
38  makes turtles zu very versatile geometrical objects.
40- Fine control over turtle movement and screen updates via delay(),
41  and enhanced tracer() and speed() methods.
43- Aliases for the most commonly used commands, like fd for forward etc.,
44  following the early Logo traditions. This reduces the boring work of
45  typing long sequences of commands, which often occur in a natural way
46  when kids try to program fancy pictures on their first encounter with
47  turtle graphcis.
49- Turtles now have an undo()-method with configurable undo-buffer.
51- Some simple commands/methods for creating event driven programs
52  (mouse-, key-, timer-events). Especially useful for programming games.
54- A scrollable Canvas class. The default scrollable Canvas can be
55  extended interactively as needed while playing around with the turtle(s).
57- A TurtleScreen class with methods controlling background color or
58  background image, window and canvas size and other properties of the
59  TurtleScreen.
61- There is a method, setworldcoordinates(), to install a user defined
62  coordinate-system for the TurtleScreen. 
64- The implementation uses a 2-vector class named Vec2D, derived from tuple.
65  This class is public, so it can be imported by the application programmer,
66  which makes certain types of computations very natural and compact.
68- Appearance of the TurtleScreen and the Turtles at startup/import can be
69  configured by means of a turtle.cfg configuration file.
70  The default configuration mimics the appearance of the old turtle module.
72- If configured appropriately the module reads in docstrings from a docstring
73  dictionary in some different language, supplied separately  and replaces
74  the english ones by those read in. There is a utility function
75  write_docstringdict() to write a dictionary with the original (english)
76  docstrings to disc, so it can serve as a template for translations.