@@ -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
@@ -2434,6 +2383,41 @@ Public classes
2434
2383
* ``a.rotate(angle) `` rotation
2435
2384
2436
2385
2386
+ .. _turtle-explanation :
2387
+
2388
+ Explanation
2389
+ ===========
2390
+
2391
+ A turtle object draws on a screen object, and there a number of key classes in
2392
+ the turtle object-oriented interface that can be used to create them and relate
2393
+ them to each other.
2394
+
2395
+ A :class: `Turtle ` instance will automatically create a :class: `Screen `
2396
+ instance if one is not already present.
2397
+
2398
+ ``Turtle `` is a subclass of :class: `RawTurtle `, which *doesn't * automatically
2399
+ create a drawing surface - a *canvas * will need to be provided or created for
2400
+ it. The *canvas * can be a :class: `tkinter.Canvas `, :class: `ScrolledCanvas `
2401
+ or :class: `TurtleScreen `.
2402
+
2403
+
2404
+ :class: `TurtleScreen ` is the basic drawing surface for a
2405
+ turtle. :class: `Screen ` is a subclass of ``TurtleScreen ``, and
2406
+ includes :ref: `some additional methods <screenspecific >` for managing its
2407
+ appearance (including size and title) and behaviour. ``TurtleScreen ``'s
2408
+ constructor needs a :class: `tkinter.Canvas ` or a
2409
+ :class: `ScrolledCanvas ` as an argument.
2410
+
2411
+ The functional interface for turtle graphics uses the various methods of
2412
+ ``Turtle `` and ``TurtleScreen ``/``Screen ``. Behind the scenes, a screen
2413
+ object is automatically created whenever a function derived from a ``Screen ``
2414
+ method is called. Similarly, a turtle object is automatically created
2415
+ whenever any of the functions derived from a Turtle method is called.
2416
+
2417
+ To use multiple turtles on a screen, the object-oriented interface must be
2418
+ used.
2419
+
2420
+
2437
2421
Help and configuration
2438
2422
======================
2439
2423
0 commit comments