<?xml version="1.0" encoding="windows-1252"?>
<node id="1008085" title="Re: AnyEvent + Wx, Gtk2/3 or Tk ?" created="2012-12-10 05:57:49" updated="2012-12-10 05:57:49">
<type id="11">
note</type>
<author id="131741">
zentara</author>
<data>
<field name="doctext">
&lt;i&gt;I have read that Wx is faster than Tk&lt;/i&gt; &lt;p&gt;
I'm not sure where you heard that, or what sort of application they were talking about. &lt;p&gt;If you want a filehandle watcher in Gtk2, you can do that, Gtk2 is pretty good in my book, although I never had trouble with Tk's speed, unless the number of widgets were very large. 
&lt;p&gt;You can run mixed event loops by making one loop a master, and the other a slave. The slave loop gets pumped every so many milliseconds by a timer in the master loop. See [id://870108] and here below is a Gtk2-Tk hybrid script. It may be useful.
&lt;c&gt;
#!/usr/bin/perl -w
use strict;
use Gtk2;
use Tk;

#setup Tk loop
my $mw = MainWindow-&gt;new(-title=&gt;'Tk Window');
my $count_tk = 0;
my $labtk = $mw-&gt;Label(-textvariable =&gt;\$count_tk)-&gt;pack; 

#setup Gtk2 loop
Gtk2-&gt;init;
my $count_gtk = 0;
my $window = Gtk2::Window-&gt;new('toplevel');
$window-&gt;set_title('Gtk2 Window');
my $glabel = Gtk2::Label-&gt;new("This is a  Gtk2 Label $count_gtk");
$window-&gt;add($glabel);
$window-&gt;show_all;

# make Tk loop the master, but you could make Gtk2 master if desired
# the lower the repeat rate, i.e. 1 ms, 
# will give more cpu time to the gtk2 loop
# this is sometimes called manually pumping the event loop
my $tktimer = $mw-&gt;repeat(10, sub{      
   $count_gtk++;
   $glabel-&gt;set_text("This is a  Gtk2 Label $count_gtk");
   Gtk2-&gt;main_iteration while Gtk2-&gt;events_pending;
   
   $count_tk++;
  });


$mw-&gt;Button(-text=&gt;' Tk control Quit  ',
       -command =&gt; sub{exit}
        )-&gt;pack();

MainLoop;

########################################

&lt;/c&gt;


&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-131741"&gt;
&lt;hr /&gt;
I'm not really a human, but I play one on earth.&lt;br&gt;
[id://630805] ................... &lt;a href=http://zentara.net/japh.html&gt; flash japh &lt;/a&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1007981</field>
<field name="parent_node">
1007981</field>
</data>
</node>
