New submission from Gregor Lingl <[EMAIL PROTECTED]>: 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) ---------- files: turtle.diff keywords: patch messages: 73712 nosy: benjamin.peterson, gregorlingl, loewis severity: normal status: open title: turtle.py - bug in Screen.__init__() type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file11591/turtle.diff _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3956> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com