Tkinter and "jumpiness"

Douglas Alan nessus at mit.edu
Wed Jun 23 16:56:10 EDT 2004


klappnase at web.de (klappnase) writes:

> Douglas Alan <nessus at mit.edu> wrote in message
> news:<lc1xkc5ysq.fsf at gaffa.mit.edu>...

>> Is it possible to double-buffer frame rendering with Tkinter?  I'm
>> writing a GUI app using Tkinter and the GUI police around here are
>> complaining about the interface being too "jumpy" at times.  If I
>> could have the frame rendered offscreen and only put onto the
>> screen once it has completely finished being rendered, then this
>> would solve the problem.

> Have you tried useing wait_visibility() on the frame like this:

> frame .wait_visibility(last_widget_that_is_created)
> frame.pack()

Hmmmm, I'm not sure that I see how this should work.  As I understand
wait_visibility(), it should wait until last_widget_that_is_created is
displayed on the screen.  But if the frame isn't yet packed, then
neither last_widget_that_is_created nor the frame will *ever* appear
on the screen, because wait_visibility() will forever wait for
something that won't happen until the waiting has finished.

I tried implementing your suggestion just to make sure that my
understanding is correct, and it behaved just as I expected -- i.e.,
it didn't work.  Is there some other more subtle usage of
wait_visibility() that you have in mind?

>> One culprit in the jumpiness is a megawidget that I am using that
>> initially displays a scrollbar and then a fraction of a second later
>> removes the scrollbar when it realizes that it is not necessary.

> I had a similar problem with a widget with automatic scrollbars I
> wrote; the fix that worked for me was not to pack() the scrollbar
> within the mega-widget's __init__ method;

That's a good idea -- thanks.  I'd prefer not to modify the
megawidget, if possible, though.  It's third-party software, and then
I'll have to worry about backporting my changes into it whenever I get
new distributions.  Also, the megawidget is not the only source of
jumpiness, so it only fixes part of the problem.  Since my original
post, I've heard rumors that one can indeed get a Tkinter frame to
double-buffer, but I haven't quite been pointed at the how to
accomplish that.  If that doesn't pan out, perhaps I'll have to resort
to tweaking the megawidget, as you suggest.

|>oug



More information about the Python-list mailing list