[Sugar-devel] Sugar, PyGTK and Threadings

2011-05-15 Thread laurent bernabe
Hello everyone,

in my application i'm developping using PyGTK, i want to use a separate
Thread to do some stuffs on the application canvas (which on my application
is set to a gtk.DrawingArea).
So i've read the PyGTK FAQ, particularly this page :PyGTK FAQ Question
20.06http://faq.pygtk.org/index.py?req=showfile=faq20.006.htp

But i wonder if i still need to call *gobject.threads_init() *in the main
module of my bundle (the one that is declared in the activity.info) as it is
inherited from sugar.activity.activity.Activity class
That is : does the sugar.activity.activity.Activity already does the work
for me ? Or where should i call threads_init() (as i don't call gtk.main()
myself) ?

Regards
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Sugar, PyGTK and Threadings

2011-05-15 Thread Benjamin M. Schwartz
On 05/15/2011 01:01 PM, laurent bernabe wrote:
 in my application i'm developping using PyGTK, i want to use a separate
 Thread to do some stuffs on the application canvas

To a first approximation, you should never use multiple threads in a PyGTK
application.  There is almost always an easier solution.

It is possible to write stable, correct multithreaded software with PyGTK,
but it is not easy, and there are very few people who know how to do it
reliably.  PyGTK is designed principally for single-threaded use.

 But i wonder if i still need to call *gobject.threads_init() *in the main
 module of my bundle (the one that is declared in the activity.info
 http://activity.info) as it is inherited from
 sugar.activity.activity.Activity class
 That is : does the sugar.activity.activity.Activity already does the work
 for me ? Or where should i call threads_init() (as i don't call gtk.main()
 myself) ?

I believe that you do have to call threads_init() yourself.  As I remember
it, Sugar does not make this call for you.



signature.asc
Description: OpenPGP digital signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel