Re: [pygtk] call set_label() periodically
Il giorno mer, 26/08/2009 alle 05.19 +0430, saeed ha scritto: When you use GTK, that's very unlikely that you need manual multithreading! ... and if it happens (usually to accomplish operations which take much time to execute and would freeze the GUI), it is much easier to keep the worker thread separate from the gtk functions (by using a buffer - usually, just a list, a dictionary or even a simple int - that the worker thread populates and the main thread just periodically looks at). ... and if you _really_ need a (non main) thread to play with gtk, don't forget to use threads_enter and thread_leave Pietro On 8/25/09, Jeffrey Barish jeff_bar...@earthlink.net wrote: Sebastian Henneberg wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, I've a strange problem with set_label on gtk.Buttons and gtk.Labels. I've a thread that gets access to the widget and should call set_label() method of the widget every second, to update the displayed data. But nothing happens... After initializing the thread, the widget's label doesn't change no more. Any suggestions where the failure could be? Use gobject.timeout_add instead of multithreading. -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] call set_label() periodically
... and if it happens (usually to accomplish operations which take much time to execute and would freeze the GUI) When a function takes a sensible time to execute, to prevent GUI from freezing, we can do frequently(mostly in the loop that takes time): while gtk.events_pending(): gtk.main_iteration_do(False) No need to manual multithreading only for this reason. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] call set_label() periodically
Il giorno gio, 27/08/2009 alle 01.30 +0430, saeed ha scritto: ... and if it happens (usually to accomplish operations which take much time to execute and would freeze the GUI) When a function takes a sensible time to execute, to prevent GUI from freezing, we can do frequently(mostly in the loop that takes time): while gtk.events_pending(): gtk.main_iteration_do(False) No need to manual multithreading only for this reason. In my experience, what took time was principally: - thumbnailing pictures/video, - retrieving and sending (big) things via Internet/bluetooth operations which are in a certain sense atomic (a single library call)... and long. (or did I misunderstand you?) Pietro ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] call set_label() periodically
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, I've a strange problem with set_label on gtk.Buttons and gtk.Labels. I've a thread that gets access to the widget and should call set_label() method of the widget every second, to update the displayed data. But nothing happens... After initializing the thread, the widget's label doesn't change no more. Any suggestions where the failure could be? Thanks, Sebastian - -- Sebastian Henneberg henne...@fim.uni-passau.de -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqTzKcACgkQ6Lm/ejYD1fdSqwCgoRQUYrxpmx1nboqr0CcfkInt /KMAn1VODqQvcp9Wk+LkHUoQRE3Y+xoh =aB0S -END PGP SIGNATURE- ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] call set_label() periodically
On Tue, Aug 25, 2009 at 7:36 PM, Sebastian Henneberg henne...@fim.uni-passau.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, Hi Sebastian, First make sure that your thread has been started in the first place. This might be a dumb question but did it start? I've a strange problem with set_label on gtk.Buttons and gtk.Labels. I've a thread that gets access to the widget and should call set_label() method of the widget every second, to update the displayed data. But nothing happens... After initializing the thread, the widget's label doesn't change no more. Any suggestions where the failure could be? Thanks, Sebastian - -- Sebastian Henneberg henne...@fim.uni-passau.de -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqTzKcACgkQ6Lm/ejYD1fdSqwCgoRQUYrxpmx1nboqr0CcfkInt /KMAn1VODqQvcp9Wk+LkHUoQRE3Y+xoh =aB0S -END PGP SIGNATURE- ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ -- b3rx Don't be trapped by dogma - which is living with the results of other people's thinking. - Steve Jobs `There are only 10 types of people in the world — those who understand binary, and those who don't.' ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] call set_label() periodically
Sebastian Henneberg wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, I've a strange problem with set_label on gtk.Buttons and gtk.Labels. I've a thread that gets access to the widget and should call set_label() method of the widget every second, to update the displayed data. But nothing happens... After initializing the thread, the widget's label doesn't change no more. Any suggestions where the failure could be? Use gobject.timeout_add instead of multithreading. -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] call set_label() periodically
When you use GTK, that's very unlikely that you need manual multithreading! On 8/25/09, Jeffrey Barish jeff_bar...@earthlink.net wrote: Sebastian Henneberg wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everybody, I've a strange problem with set_label on gtk.Buttons and gtk.Labels. I've a thread that gets access to the widget and should call set_label() method of the widget every second, to update the displayed data. But nothing happens... After initializing the thread, the widget's label doesn't change no more. Any suggestions where the failure could be? Use gobject.timeout_add instead of multithreading. -- Jeffrey Barish ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/