Changing cursors...

Xtian Muirhead xtian_the_great at hotmail.com
Sun Oct 31 20:04:24 EST 1999


Gordon McMillan <gmcm at hypernet.com> wrote in message
news:1270748767-19272684 at hypernet.com...
> Xtian Muirhead writes:
> >
> > I've been having a play with Tkinter, and I've ported across a
> > program that I wrote while learning VB, but I've had one problem.
> > There's one step that has a chunk of processing which takes a few
> > seconds to complete. In the old program, I changed the cursor to
> > an hourglass at the start, and reset when the program finished.
> > Trying to do the same in the new version doesn't seem to work:
>
> [snip]
>
> No Tk expert, but as I recall, this is a general problem with Tk.
> Even murkier: I think Tk schedules the cursor-change which
> means, of course, that it doesn't happen until too late. (Java's
> AWT had/has? the same problem but even worse - it would
> get confused and leave the cursor in the wrong state).
>
> The work-around that I saw wasn't, to my mind, worth the
> effort, and I decided to be satisfied with the button remaining
> depressed. But perhaps the eff-bot has a more elegant
> solution.
>

Hmmm. I tried changing the call to update_idletasks() to update()
(having read eff-bot's warning not to use it in callback events for
fear of producing race conditions), and it works. Maybe it's only OK
because I've disabled the button which invokes the callback, so we
don't get any contention? (Ooh, it looks like I can double click the
button before it disables. Probably that could do something nasty in
a more interesting application.) So I guess it's not the best plan,
but it'll do for this one.

Anyway, thanks for the answer, even if it was a "Yup, that's a problem
alright".

(Actually, that's a relatively comforting response. I'd hate
to be caught asking a "Read the documentation, second page, third
sentence"-response-getting question. And there's gotta be a better
way to have been putting that. Darn.)

Have a day!
Xtian

xtian at regurgitator.zzn.com

"I'd rather be rich than stupid."








More information about the Python-list mailing list