Re: Best way to busy-wait in Python 3 / Gtk+ 3?



On Sun, Oct 7, 2012 at 12:29 PM, Filip Lamparski
<matka poohatka gmail com> wrote:
On 7 October 2012 12:58, <jcupitt gmail com> wrote:

To have the load in another process, use a pipe to send worker results
back to the main process, and add the pipe to your gtk main loop as an
event source.


Is there any way I could do that? I looked at GLib's main loop and Gtk's
main loop, but can't seem to find it.

Is the idea to have a first pass downloading image files in a separate
process and then use a thread to load them into memory? I don't know
much about GStreamer but it seems like it might be helpful technology
in this realm.

For completeness, you can use pythons multiprocessing module along
with GLib's io watch:

parent, child = multiprocessing.Pipe()
GLib.io_add_watch(parent, GLib.IOCondition.IN, event_callback)
process = multiprocessing.Process(target=worker_func, args=(child,))
process.start()

-Simon



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]