I've a function taking quite a long time to perform and I'm trying to change the cursor to an hour glass during the time the function is executed. But it only works the very first time the function is called. I'm doing this (it's in an on_click event handler of a button):
from gi.repository import Gtk, Gdk, GObject
import time
def on_grabbtn_clicked(self, button):
# Change the cursor to hour Glass
cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH)
self.window.get_root_window().set_cursor(cursor)
# lenghty process here
time.sleep(10)
# Set the cursor to normal Arrow
cursor = Gdk.Cursor.new(Gdk.CursorType.ARROW)
self.window.get_root_window().set_cursor(cursor)
window is a window build with Glade/GtkBuilder and named...window.
I get a handle on it in the __init__() of the window class like this:
self.window = self.builder.get_object('window')
As I said, the hour glass appears only the first time I click on the button. The second time it doesn't work anymore. So I'm doing it wrong. But what Am I doing wrong ?

get_root_windowreturns the window of the desktop in the background, you probably wantget_windowhere. – Flimm Nov 16 '12 at 17:31