busunsl has asked for the wisdom of the Perl Monks concerning the following question:

I have written some applications using Tk.
When displaying dialogs, the window appears immediately, but the display of the contents is delayed about a second.

I tested this on Linux using KDE, KDE2 and enlightenment as windowmanagers.

A test with Perl/Tk running on AIX and Exceed running on a NT machine showed no delay.

You can test it by yourself with:

perl -MTk -e 'tkinit->Dialog()->Show'
This will bring up a dialog window with an 'Ok' button. The display of the button will be delayed on KDE and enlightenment.

Any idea what's causing the delay and what you can do against it?

Replies are listed 'Best First'.
Re: Why is the display of the contents of a TK Dialog delayed
by clintp (Curate) on Mar 16, 2001 at 20:21 UTC
    I've noticed the same delay on my Linux system at home, and never bothered to persue it. The default GUI setup on a RedHat system (gnome, kde, enlightenment, xfree, etc...) is so convoluted, perverse, and made up of such poor quality components it's a wonder it works<super>*</super>.

    The initial frame appears quickly enough, but the packing takes quite a while. This (probably) eliminates the X server and the window manager. This leaves the widget toolkits.

    The delay does not exist under AIX (with local display) or under Windows NT (native Win32 Tk). Nor running from AIX or Irix displaying to Linux's X server.

    *The wonderful thing about a dancing bear is not how well he dances,but that he dances at all.

      I don't think it's the toolkit. During the delay the cpu load is zero.
      It looks like a sleep 1.
        Running strace or the equivalent will turn up a sleep syscall if there is one. You might want to do that (I'm not at home and can't myself...).
Re: Why is the display of the contents of a TK Dialog delayed
by TheoPetersen (Priest) on Mar 16, 2001 at 21:41 UTC
    I've suffered from this for a long while myself. It's a window manager thing, but I haven't heard of anyone actually fixing it.

    You can find more discussion (and window managers that don't have the problem) in these threads from comp.lang.perl.tk: DialogBox delay and Tk:Dialog slow.

      Thanks for that.

      The solution, or a workaround, is at the end of the second thread:

      remove the line: $w->raise; from Post.al
      or remove the line from Wm.pm before building Tk
      and the delay will disapear.

      I don't know enough of Tk to understand the implications of this, but it looks like a misfeature, that should be removed.