Re: Best way to busy-wait in Python 3 / Gtk+ 3?
- From: Arne Pagel <arne pagelnet de>
- To: gtk-app-devel-list gnome org
- Subject: Re: Best way to busy-wait in Python 3 / Gtk+ 3?
- Date: Sun, 07 Oct 2012 17:09:19 +0200
Just notice the GTK is not thread Safe,
you might get in trouble if you make unsynchronized gtk_... calls from different processes.
I just found one Page with some hints at this:
http://blogs.operationaldynamics.com/andrew/software/gnome-desktop/gtk-thread-awareness
In my case I followed the rule “you must only make GTK library calls from the main thread”
and separated GUI and I/O stuff.
What also often helps instead heving a separate processes are functions called from gtk_idle_add or
gtk_timeout_add,
but this would require that you can design your former process stuff nonblocking.
--
Arne
Am 07.10.2012 11:23, schrieb jcupitt gmail com:
On 6 October 2012 15:48, Filip Lamparski<matka poohatka gmail com> wrote:
However, the thumbnail loading process takes a long time, so I want to put
it into another process, with the GUI displaying a spinner or a progress
bar until the loading finishes.
Sorry, I don't use Python much, but in C you'd start a thread to do
the load and then have that call g_idle_add() when it finished.
Meanwhile the main thread stays just handling inputs and repaints, but
you display some sort of busy indicator until the idle callback fires.
Something like:
on_load_button_click:
busy = True
update_view
start worker thread
worker thread:
load thumbnail
g_idle_add (thumbnail_done, thumbnail)
thumbnail_done (thumbnail)
busy = False
set thumbnail
update_view
John
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]