Re: GTK2 hangs or does not updates



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

Hi 

I attached my small program


Not sure if you wanted it posted to the list, but the problem is with two threads accessing Gtk2.

Changed it to use an idle handler, but you can also use a timeout handler.  Here though it does not seem as 
if the console output changes, even with the original script, so not sure if there is still things needed, 
and I did not look too closely at what you are trying to do.


Cheers

Martin

Thanks

2010/6/22 Martin Schlemmer <Martin Schlemmer nwu ac za>

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 





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

Attachment: pantalla_indicadora-2.diff
Description: Binary data



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