[pygtk] centralized multiple instances of a pygtk app
Pietro Battiston
me at pietrobattiston.it
Fri Apr 1 01:43:46 WST 2011
Il giorno mer, 30/03/2011 alle 13.50 +0200, Giuseppe Penone ha scritto:
> I found some tips on threading on pygtk
> (http://faq.pygtk.org/index.py?file=faq20.006.htp&req=show) so I tried
> gtk.threads_enter()
>
> gtk.main()
> gtk.threads_leave()
> that works on the first opened instance but then crashes on the
> second.
>
> If anybody has a clue about treating many instances of the same app
> being aware of an already running instance/able to
> control the already running instance rather than spawning a new one
> please help me.
>
(Assuming that indeed there's no way of using sockets in a non-blocking
fashion - I'm totally ignorant about that) maybe having a little process
created with multiprocessing would be simpler & more portable, for you,
than using threading? I guess a single one is sufficient, so the
overhead shouldn't be significant, even on Windows. Then, at every
iteration of the main loop, the main process could check, from a shared
Value (or Array), if there's something to open.
(untested, sorry if I wrote something stupid)
Pietro
More information about the pygtk
mailing list