I have read that Wx is faster than Tk
I'm not sure where you heard that, or what sort of application they were talking about. 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.
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 Wx with Tk and here below is a Gtk2-Tk hybrid script. It may be useful.
#!/usr/bin/perl -w
use strict;
use Gtk2;
use Tk;
#setup Tk loop
my $mw = MainWindow->new(-title=>'Tk Window');
my $count_tk = 0;
my $labtk = $mw->Label(-textvariable =>\$count_tk)->pack;
#setup Gtk2 loop
Gtk2->init;
my $count_gtk = 0;
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Gtk2 Window');
my $glabel = Gtk2::Label->new("This is a Gtk2 Label $count_gtk");
$window->add($glabel);
$window->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->repeat(10, sub{
$count_gtk++;
$glabel->set_text("This is a Gtk2 Label $count_gtk");
Gtk2->main_iteration while Gtk2->events_pending;
$count_tk++;
});
$mw->Button(-text=>' Tk control Quit ',
-command => sub{exit}
)->pack();
MainLoop;
########################################
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|