Re: Flashing label



On Wed, Jul 14, 2004 at 16:16:58 +1000, Daniel Kasak wrote:
What would be involved in making a label flash?
I'd have to do something like create a new thread that wakes up every so 
often and alternates the colour of the label, right?

You should seldom need or use threads in Gtk application. A Gtk
application runs in an event loop (Glib::MainLoop). That event loop
takes care of user actions, but can also deal with other things.
One of them is "idle", which happens every time there are no other
events to process and "timeout", which happens after given time, perhaps
periodicaly. You can do background computation with idles
(Glib::Idle->add). You can do periodic things with timeouts
(Glib::Timeout->add). You can wait for input on arbitrary filedescriptors
with io watches (Glib::IO->add_wathc).

I'd had a brief look at threading under Perl, and I'm getting confused 
already ( nothing new, I know ). It looks like there are a number of 
methods of threading under Perl. I also seem to remember getting a 
warning when I was compiling Perl that threading was disabled unless I 
explicitely enabled it.

Gtk2-perl does not play too well with perl threading. There were some GC
issues. I believe they are fixed in latest devel, though I am not sure.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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