|
Re: Threading on win32: msg#00166gnome.gtk+.python
Hugo Hallqvist wrote: Hello everyone, I think that gobject.idle_add is the simplest solution, and AFAIK you don't need to enter the gdk lock to call it. Note that you do need to enter the gdk lock inside the idle function if you are doing gui stuff in it. If you're using Python 2.4, you can wrap it up as a decorator. The following code is untesed, and probably gratuitous :-) def idlefunction(function): def in_idle(args, kw): gtk.threads_enter() try: function(*args, **kw) return False finally: gtk.threads_leave() def wrapper(*args, **kw): gobject.idle_add(in_idle, args, kw) return wrapper @idlefunction def show_message(message): w = gtk.Window() w.add(gtk.Label(message)) w.show_all() -- Tim Evans Applied Research Associates NZ http://www.aranz.com/ _______________________________________________ pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | ANNOUNCE: GnomePython 2.9.5 (unstable): 00166, Gustavo J. A. M. Carneiro |
|---|---|
| Next by Date: | Re: Verifying Entry inputs: 00166, Gustavo J. A. M. Carneiro |
| Previous by Thread: | Threading on win32i: 00166, Hugo Hallqvist |
| Next by Thread: | TreeModelFilter performance with large models: 00166, John Gill |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |