Re: GTK2 hangs or does not updates



On 2010/06/22 at 04:32 AM, PS <kaligod gmail com> wrote:

Hi,
 
Currently I am introducing myself to the perl-gtk GUI programming. My first
program is a dashboard that should update every minute, it can update a
couple times but no more, the main GTK windows hangs and no more updates are
possible.

The main thread is the GUI and has two secondary threads, one if for
catching the time and the second one of for making the updates to the
labels. I know the threads are working ok, if a print the result of the
update to the console I can see it is running fine, but again, the windows
hangs (freezes itself) and no more updates are possible.


I do not know with Linux, but in Windows you should only initialize Gtk2 in one thread (I usually use the 
main one), and then only do updates to the GUI from that thread.  If you are waiting for something from 
another thread, you need to keep updating the MainLoop while waiting for the data from the second thread.  
Bad things happen if you update the GUI from a second thread.

Something like attached - it was a quick bit of copy and paste, so please be gentle :-)


Regards,

Martin


May you help me?

Pablo Soto



Vrywaringsklousule / Disclaimer:  http://www.nwu.ac.za/it/gov-man/disclaimer.html 

Attachment: Time.glade
Description: Binary data

Attachment: Time.pl
Description: Binary data



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