This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregorlingl
Recipients benjamin.peterson, gregorlingl, loewis
Date 2008-09-24.13:42:56
SpamBayes Score 4.2188475e-14
Marked as misclassified No
Message-id <1222263778.39.0.275068450449.issue3956@psf.upfronthosting.co.za>
In-reply-to
Content
There is a bug in Screen.__init__() (The Screen class uses the Borg
idiom to simulate a Singleton).

This bug is demonstrated best interactively from IDLE (using the -n
switch) like this:

>>> from turtle import Screen, Turtle
>>> t = Turtle()
>>> t.fd(100)     # idea: let's have a yellow background, so we need
                  # *the* screen
>>> s = Screen()  # the drawing vanishes
>>> s.turtles()
[]

This is undesired behaviour. Instead the Screen() call should leave the
drawings an the turtles untouched and return the already existing
Screen. So the call of turtles() would result in something like:

>>> s.turtles()
[<turtle.Turtle object at 0x01490330>]

This is accomplished by the patch described in the attached file turtle.diff

Of course sequences of commands like those shown in the interactive
session above do not occur in well designed scripts, but they may well
occur during sessions of students in interactive classroom use. 

Two more important notes:

(1) This patch is already done in turtle.py for Python 3.0. So in 2.6 it
would ensure that Turtles and the Screen show identical behaviour in
both versions.

(2) This patch makes necessary one other patch in turtleDemo.py - in the
Demo directory - which is shown in the attached turtleDemo.diff 
turtleDemo.py is not a normal turtle application but a GUI - utility
designed to run a series of 'normal' turtle - apps conforming to some
simple rules (These apps in most cases use a Screen()). So when
switching from one to another demo script within turtleDemo one wants to
reinitialize the Canvas - what is just the contrary of what one wants
normally as explained above. This is accomplished by this patch of
turtleDemo.py. (This patch is also already done for Python 3.0)
History
Date User Action Args
2008-09-24 13:42:58gregorlinglsetrecipients: + gregorlingl, loewis, benjamin.peterson
2008-09-24 13:42:58gregorlinglsetmessageid: <1222263778.39.0.275068450449.issue3956@psf.upfronthosting.co.za>
2008-09-24 13:42:57gregorlingllinkissue3956 messages
2008-09-24 13:42:56gregorlinglcreate