[Charlotte.PM] Code inside Perl Tk
Redvers Davies
red at criticalintegration.com
Fri Aug 17 07:47:15 PDT 2007
On Fri, 2007-08-17 at 10:05 -0400, Christopher Fowler wrote:
> Are there any Perl TK wizards here?
I'm not, but I may have an idea.
> I'm playing with Perl Tk to create a GUI that selects on many sockets
> and displays messages from remote servers. The problem I'm having is
> understanding where I need to execute my select loop. It seems all the
> examples I've looked at shows the building of the GUI and then the
> execution of 'MainLoop'. At that point I no longer have control of the
> program.
The same is true of Gtk which is where my experience lies (although its
been a fair few years since I've been active in that project). Gtk
however has an events_pending and main_iteration which we use as
follows:
while (1) {
you_select_stuff_here();
while (Gtk2->events_pending) {
Gtk2->main_iteration;
}
}
which does exactly as you'd expect.
There may be similer methods in Tk.pm - Good luck.
Red
(Who really needs to go to a charlotte.pm meeting even if it is to say
hi or do a talk on Gtk2.pm or OpenMoko).
More information about the charlotte
mailing list