[Edu-sig] How to explore Tkinter interactively with IDLE 1.0
glingl at aon.at
Fri Sep 26 05:48:34 EDT 2003
> Conlusion: There is a bug somewhere, but I can't even loacate it exactly.
I think (I hope) that I've found the bug in turtle.py. It has to do with
updating the Canvas.
This is not done, when tracer(0) is issued.
Updating is regularely done in _draw_turtle. But not, if self._tracing
is turned off.
- see line 290 of turtle.py - .
So there we have to insert a statement for updating the canvas. E.g.:
if not self._tracing:
self._canvas.update() # <== Insert this line
if position == :
# etc. etc.
With this correction interactive use of turtle.py is possible and demo
runs as expected.
Without it the program seems to remain hanging because of some pending
The turtle-window has still to be closed via Shell/restart as Kirby
(I must confess that I still not have a profound understanding of the
maybe there are similar pitfalls in the code of turtle.py still hanging
I'll test this extensively soon.
> Examples 2, concerning a different sort of problem:
> >>> from Tkinter import *
> >>> root = Tk() # Nothing happens; in IDLE 0.8 a tiny empty
> Tk-Window appeared
> >>> cv = Canvas(root)
> >>> cv.pack() # Still nothing happens; in IDLE 0.8 you saw the
> Canvas packed intp
> # the TK window (default-size of the Canvas)
> >>> root.mainloop() # this was not advised in IDLE 0.8
> Now the Tk-Window appears on the screen (same appearance as in IDLE 0.8)
> but - of course - I cannot input any more statements into IDLE, I think
> because of the running mainloop(). Only when I close the newly created
> IDLE is ready for more input.
> Conclusion: I can't play around any more with Tkinter windows
> Any ideas?
> Kirby Urner schrieb:
>>> Hi Kirby,
>>> this definitely doesn't work on my machine (Windows XP with Python 3.2)
>> I just downloaded 2.3.1 today or yesterday. That couldn't be the
>> could it? Windows XP here too.
>> It's true for me as well that when I first say up(), the Tk window is
>> the main one. I see it by sliding the main one out of the way. I don't
>> touch the secondary one.
>> The secondary window (showing the turtle) is not responsive in the usual
>> For example, if I hit the maximize icon, nothing happens. But next
>> time I
>> go up(), the window maximizes (i.e. the action occurs only on
>> refresh). Likewise to shrink it down again (using the icon) -- the
>> event is postponed until the next turtle event.
>> If the secondary window minimizes to the task bar, I double-click on it.
>> Then I go up() or setx() or something, and it tends to return to its
>> previous (open) state.
>> If a window moves in front of the secondary window, and then is moved
>> the secondary window will not refresh and is likely blank -- until
>> the next
>> turtle event.
> Edu-sig mailing list
> Edu-sig at python.org
More information about the Edu-sig