Tk: Temporarily change cursor?

Greg Ewing greg.ewing at compaq.com
Tue Jul 20 17:37:27 EDT 1999


Greg McFarlane wrote:
> 
>     Blt: http://www.tcltk.com/blt/

I've just looked at the web page for Blt, and it says
this about the "busy" command:

  Manages an invisible "busy" window which prevents further
  user device (keyboard, mouse, button, etc.) interactions.

I don't like the sound of that. I don't want to lock
up the whole machine and prevent interaction with
windows belonging to other processes.

In an old news article I was referred to,
Fredrik Lundh <fredrik at pythonware.com> wrote:

> if you change the cursor for a toplevel (or the root window),
> that cursor will be used for all widgets that doesn't specify their own
> cursors. 

I tried things like that, but they didn't work.
Changing the root window's cursor doesn't affect
any other toplevels, even if they don't define their
own cursor. Also, when the pointer was over a subwidget
of a toplevel, changing the toplevel's cursor and then
doing an update didn't work reliably if the mouse
buton was down at the time!

I've since found a method that seems to work on Windows:
Use winfo_pointerxy and winfo_containing to find the
widget under the pointer, change its cursor, and
update. It'll only work if the pointer happens to be
over one of the application's windows at the time, but
if the user has just clicked on something, this will
probably be true. It'll do for now.

Thanks for the help,
Greg




More information about the Python-list mailing list