A recent thread brought up the question 'what do you use gevent for?':
http://groups.google.com/group/gevent/browse_thread/thread/4de9703e5dca8271
I' discovered gevent after some exploration (the usual way: asyncore,
twisted, concurrence, eventlet, ...) and I like it a lot. Now I intend
to use it to build a pygtk applicattion (target: Linux/Windows), but I
found no references.
Taking the "concurrent_download.py" example as an starting point, I
made this minimum demo code:
http://zaudera/public/gtkdown.py
It works, but I have some questions:
- Has anyone used gevent with pygtk?
- Is this the correct way of joining gevent jobs when you have another
events loop?
- Why a control+c does not quit the script as usual (after all jobs
have finished)? I have to control+z and kill the process manually.
Obviously, the app will do a clean "gtk.main_quit()", and this works,
but I am afraid this might be denoting some kind of issue with my
code.
thanks,
> http://zaudera/public/gtkdown.py
Sorry guys, that's obviously wrong, try please:
http://109.74.199.145/public/gtkdown.py
(Thanks for pointing it out, Denis)
On Sun, Mar 14, 2010 at 7:45 PM, Arnau Sanchez <tok...@gmail.com> wrote:
> - Why a control+c does not quit the script as usual (after all jobs
> have finished)? I have to control+z and kill the process manually.
> Obviously, the app will do a clean "gtk.main_quit()", and this works,
> but I am afraid this might be denoting some kind of issue with my
> code.
I've fixed it to make ctrl-c work (in the attachment). There's also
a way to exit the script after all jobs have finished, which is to spawn a new
job that will wait for the jobs and then call gtk.main_quit().
Let me know if there are other issues.
Cheers,
Denis.
On 14/03/10 20:03, Denis Bilenko wrote:
> I've fixed it to make ctrl-c work (in the attachment). There's also
> a way to exit the script after all jobs have finished, which is to spawn a new
> job that will wait for the jobs and then call gtk.main_quit().
Thanks, now it works perfect! I've added a gtk.Window with a button to test the
responsiveness and it runs smoothly.
Your code also gives me some hints about how to do it with eventlet, I am
testing both (eventlet has the advantage -when distributing- of being pure python).
thanks!
arnau