@@ -277,67 +277,16 @@ The turtle's screen can be customised, for example::
277
277
t.screen.bgcolor("orange")
278
278
279
279
280
- .. _turtle-explanation :
281
-
282
- Explanation
283
- ===========
284
-
285
- The :mod: `turtle ` module is an extended reimplementation of the same-named
286
- module from the Python standard distribution up to version Python 2.5.
287
-
288
- It tries to keep the merits of the old turtle module and to be (nearly) 100%
289
- compatible with it. This means in the first place to enable the learning
290
- programmer to use all the commands, classes and methods interactively when using
291
- the module from within IDLE run with the ``-n `` switch.
292
-
293
- The turtle module provides turtle graphics primitives, in both object-oriented
294
- and procedure-oriented ways. Because it uses :mod: `tkinter ` for the underlying
295
- graphics, it needs a version of Python installed with Tk support.
296
-
297
- The object-oriented interface uses essentially two+two classes:
298
-
299
- 1. The :class: `TurtleScreen ` class defines graphics windows as a playground for
300
- the drawing turtles. Its constructor needs a :class: `tkinter.Canvas ` or a
301
- :class: `ScrolledCanvas ` as argument. It should be used when :mod: `turtle ` is
302
- used as part of some application.
303
-
304
- The function :func: `Screen ` returns a singleton object of a
305
- :class: `TurtleScreen ` subclass. This function should be used when
306
- :mod: `turtle ` is used as a standalone tool for doing graphics.
307
- As a singleton object, inheriting from its class is not possible.
308
-
309
- All methods of TurtleScreen/Screen also exist as functions, i.e. as part of
310
- the procedure-oriented interface.
311
-
312
- 2. :class: `RawTurtle ` (alias: :class: `RawPen `) defines Turtle objects which draw
313
- on a :class: `TurtleScreen `. Its constructor needs a Canvas, ScrolledCanvas
314
- or TurtleScreen as argument, so the RawTurtle objects know where to draw.
315
-
316
- Derived from RawTurtle is the subclass :class: `Turtle ` (alias: :class: `Pen `),
317
- which draws on "the" :class: `Screen ` instance which is automatically
318
- created, if not already present.
319
-
320
- All methods of RawTurtle/Turtle also exist as functions, i.e. part of the
321
- procedure-oriented interface.
322
-
323
- The procedural interface provides functions which are derived from the methods
324
- of the classes :class: `Screen ` and :class: `Turtle `. They have the same names as
325
- the corresponding methods. A screen object is automatically created whenever a
326
- function derived from a Screen method is called. An (unnamed) turtle object is
327
- automatically created whenever any of the functions derived from a Turtle method
328
- is called.
329
-
330
- To use multiple turtles on a screen one has to use the object-oriented interface.
280
+ Turtle graphics reference
281
+ =========================
331
282
332
283
.. note ::
284
+
333
285
In the following documentation the argument list for functions is given.
334
286
Methods, of course, have the additional first argument *self * which is
335
287
omitted here.
336
288
337
289
338
- Turtle graphics reference
339
- =========================
340
-
341
290
Turtle methods
342
291
--------------
343
292
@@ -2465,6 +2414,41 @@ Public classes
2465
2414
* ``a.rotate(angle) `` rotation
2466
2415
2467
2416
2417
+ .. _turtle-explanation :
2418
+
2419
+ Explanation
2420
+ ===========
2421
+
2422
+ A turtle object draws on a screen object, and there a number of key classes in
2423
+ the turtle object-oriented interface that can be used to create them and relate
2424
+ them to each other.
2425
+
2426
+ A :class: `Turtle ` instance will automatically create a :class: `Screen `
2427
+ instance if one is not already present.
2428
+
2429
+ ``Turtle `` is a subclass of :class: `RawTurtle `, which *doesn't * automatically
2430
+ create a drawing surface - a *canvas * will need to be provided or created for
2431
+ it. The *canvas * can be a :class: `tkinter.Canvas `, :class: `ScrolledCanvas `
2432
+ or :class: `TurtleScreen `.
2433
+
2434
+
2435
+ :class: `TurtleScreen ` is the basic drawing surface for a
2436
+ turtle. :class: `Screen ` is a subclass of ``TurtleScreen ``, and
2437
+ includes :ref: `some additional methods <screenspecific >` for managing its
2438
+ appearance (including size and title) and behaviour. ``TurtleScreen ``'s
2439
+ constructor needs a :class: `tkinter.Canvas ` or a
2440
+ :class: `ScrolledCanvas ` as an argument.
2441
+
2442
+ The functional interface for turtle graphics uses the various methods of
2443
+ ``Turtle `` and ``TurtleScreen ``/``Screen ``. Behind the scenes, a screen
2444
+ object is automatically created whenever a function derived from a ``Screen ``
2445
+ method is called. Similarly, a turtle object is automatically created
2446
+ whenever any of the functions derived from a Turtle method is called.
2447
+
2448
+ To use multiple turtles on a screen, the object-oriented interface must be
2449
+ used.
2450
+
2451
+
2468
2452
Help and configuration
2469
2453
======================
2470
2454
0 commit comments