[Charlotte.PM] Code inside Perl Tk

Christopher Fowler cfowler at outpostsentinel.com
Fri Aug 17 11:38:18 PDT 2007


Here is a page that talks about MainLoop

http://www.oreilly.com/catalog/mastperltk/chapter/ch15.html


It appears that I might have to do my select() within a loop.  I think
this may make events block until the timeout on the select().  It
appears I can not create threads that can update GUI elements.  I'll
have to try this and see what effect blocking forever in a select() does
when I clock a button.  It could just interrupt the select() and then
even code will be processed


On Fri, 2007-08-17 at 10:47 -0400, Redvers Davies wrote:
> 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