pygtk - What is the best way to change the mouse pointer
IDOL at il.ibm.com
Thu Aug 27 12:57:49 CEST 2009
> MRAB <python at mrabarnett.plus.com>
> python-list at python.org
> 26/08/2009 11:04 PM
> Re: pygtk - What is the best way to change the mouse pointer
> Ido Levy wrote:
> > Hello All,
> > I am writing a dialog which one of its widget is a gtk.ComboBoxEntry (
> > let's assume widget in the example below is its instance )
> > When the user select one of the values from the gtk.ComboBoxEntry I
> > to run some calculations that takes a few seconds.
> > In order to reflect calculation time to the user I want to switch the
> > mouse pointer to an hour glass and back to arrow what it finish the
> > calculation.
> > I use the following code but it doesn't seems to work in a
> > way. From time to time it skips the last line and keep the mouse
> > as an hour glass.
> > watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
> > widget.window.set_cursor(watch)
> > calculation code
> > widget.window.set_cursor(None)
> > I would appreciate your advice on the right way to implement this.
> Could the calculation code be raising an exception? Try adding some
> logging to see whether the last lien is actually being called. You could
> also use a try...finally... block to ensure that the last line is
> watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
> calculation code
Thank you for your input.
I used logging and it seems that the last line is called.
I also used try...finally... block but it didn't solve the issue.
Then I have noticed that the line before the last one is widget.connect()
I insert time.sleep() in between the lines and it seems to solve the
I assume it's not suppose to work this way but it can be considered as a
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list