On 11 March 2013 00:37, Timo <timomli...@gmail.com> wrote: > I seem to be unable to change the cursor on one widget only, not an entire > window. How is this done? Below is a testscript which I thought was the > right way. > > Run normal to use PyGI, run with -p argument for PyGTK. Both act the same.
> def run_pygtk(): > import gtk > > def disable_cb(widget): > widget.set_sensitive(False) > cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) > widget.window.set_cursor(cursor) This works for widgets which have their own gtk.gdkWindows. It's mentioned in the gtk docs that this isn't always the case, and several widgets will return their parent's gtk.gdk.Window. You can check for this using the get_has_window method. One approach is to stuff the buttons inside an EventBox, since that will definitely provide it's own gtk.gdk.Window - something along the lines of: def run_pygtk(): import gtk def disable_cb(widget, eventbox): widget.set_sensitive(False) cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) eventbox.window.set_cursor(cursor) win = gtk.Window() win.resize(400, 400) win.set_title("PyGTK example") win.connect('delete-event', gtk.main_quit) eventbox = gtk.EventBox() b1 = gtk.Button('Disable me') b1.connect('clicked', disable_cb, eventbox) eventbox.add(b1) b2 = gtk.Button('I do nothing') box = gtk.VBox() box.pack_start(eventbox, False, False, 0) box.pack_start(b2, False, False, 0) win.add(box) win.show_all() -- Neil Muller drnlmul...@gmail.com I've got a gmail account. Why haven't I become cool? _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/