Re: Updating GUI during long operation



On Sun, 21 Apr 2013 11:33:45 +0100
Chris Vine <chris cvine freeserve co uk> wrote:
On Sat, 20 Apr 2013 16:25:50 -0700
Kip Warner <kip thevertigo com> wrote:
On Sat, 2013-04-20 at 23:35 +0100, Chris Vine wrote:
If you have a main loop running, this is completely unnecessary,
unless you are doing something to block the loop, which you
shouldn't do.

Hey Chris. Although your response was not particularly constructive,
I'll give you the benefit of the doubt. Perhaps I am doing something
unnecessary to block the loop which I should not do. Take a look at
the method defined at 287:

Thank you for your condescension: an interesting way of asking for
help.

The code to which you refer does not block, so something else is
blocking the loop. The point you need to understand is that in normal
code there will very rarely be a reason to call "while
Gtk.events_pending(): Gtk.main_iteration()" in a well behaved
application (although that call does not appear in the file to which
you refer), and it would need special justification and explanation.
Furthermore your original posting appeared to indicate ("including the
following within it...") that those iteration calls were made in some
idle handler somewhere, which on the face of it is pointless.

By the way, rather than overt blocking it may just be that the program
is putting more graphical events through the main loop than it can
handle.  Since any one main loop is single threaded there is very
little you can do about that, except reduce the rate at which you pass
events to the main loop.  Since any thread can have its own main loop
you may be able to pass some event-driven work off to another loop,
but any graphical (GDK/GTK) events have to go to the main loop, and
there is no easy way out of that.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]