[Sugar-devel] Sugar, PyGTK and Threadings

Benjamin M. Schwartz bmschwar at fas.harvard.edu
Sun May 15 13:34:47 EDT 2011


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110515/e48c6ef0/attachment-0001.pgp>


More information about the Sugar-devel mailing list