Re: pb mixing POE and Gtk::GladeXML



On Mon, 2002-04-29 at 16:49, Stéphane Payrard wrote:
<snip>
This is part of an ongoing port of TeXmacs to gtk and perl.
I want to eventually make the typesetting canvas a gtk
widget and control everything using POE. This very ambitious because
I am new too gtk-perl and POE.

If you are curious, for more info on TeXmacs and this port, see:
www.texmacs.org, http://www.alqua.com/tmresources/port%20to%20perl-gtk
</snip>

While I don't want to discourage you from using POE, Gtk/Gnome has its
own event loop.  The only problem with using Perl and Gtk is that Perl
is not threaded by default so you lose access to the GUI when you are
doing something complex in one of the handlers.  I ran into this in my
Gnome based SQL editor when I was fetching the result sets.  The
application would freeze until all of the data had been put into the
Gtk::CList; at which time the application would suddenly spring back to
life.  I was able to fix this by putting calls to Gtk->main_iteration
(which refreshes the app and handles events that are waiting to be
handled).  The relevant section of code looks like this:

sub on_mi_run_activate {
        .
        .
        .
        my $i = 0;
        while (my $ref = $sth->fetch) {
                last if $stop;
                no warnings; #I don't care about undef
                $list->freeze;
                $list->append(@$ref);
                $list->thaw;
                use warnings;
                Gtk->main_iteration while (Gtk->events_pending);
        }
        .
        .
        .
}

-- 
Today is Prickle-Prickle the 46th day of Discord in the YOLD 3168
This statement is false.

Missile Address: 33:48:3.521N  84:23:34.786W




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