Problem with BLT busy cursor on NT

Greg McFarlane gregm at iname.com
Thu Jul 8 22:22:42 EDT 1999


For those interested, here is the reply from George Howlett, author of
BLT, which he posted to comp.lang.tcl.  The problem is with cursors in
Tk under NT and is not specific to BLT.

>From George A. Howlett <gah at cadence.com>:
> Use "update" instead of "update idletasks". 
>  
> The transparent busy window needs to be mapped, raised, and resized
> each time you "hold" a widget busy.  Remember also that Windows,
> unlike X11, doesn't manage cursors on an individual window basis.  Tk
> emulates this behavior by watching Enter/Leave events in Tk windows. 
> A further compilication is that Windows doesn't immediately change the
> cursor when it's set.  Instead, it waits for the mouse to be moved or
> the next system call.

In python, the answer is:
> Use update() instead of update_idletasks(). 

On 7 Jul, Greg McFarlane wrote:
> Has anyone noticed that, under some circumstances, the BLT busy cursor
> is not displayed under NT?  The (tcl) code below demonstrates this. 
> (The equivalent python has the same problem, so it is not a problem
> with python, but someone on that mailing list may know that answer.)
> 
> Clicking on the top "Show busy" button changes the text of the button
> as well as displaying the busy cursor for two seconds, as expected. 
> Under Unix, clicking on the second button does the same thing, but
> under NT, it only changes the text of the button for two seconds and
> does not display the busy cursor.
> 
> It seems that, under NT, to actually get the busy cursor displayed,
> the interpreter has to return to the main loop after a call to
> blt::busy.  If there is a long lasting calculation or a blocked read,
> etc, then the cursor will not be not changed.  I would have thought
> that the call to "update idletasks" would have been enough to flush
> out the cursor change.
> 
> Has anyone seen this before?  Is it a bug in BLT or a limitation
> of NT?
> 
> ==================================================================
> package require BLT
> 
> proc startBeingBusy {} {
>     .b1 configure -text "I am busy..."
>     ::blt::busy hold .
>     update idletasks
>     after 2000 stopBeingBusy
> }
> 
> proc stopBeingBusy {} {
>     ::blt::busy release .
>     .b1 configure -text "Show busy"
> }
> 
> proc beBusy {} {
>     .b2 configure -text "I am busy..."
>     ::blt::busy hold .
>     update idletasks
>     after 2000
>     ::blt::busy release .
>     .b2 configure -text "Show busy"
> }
> 
> button .b1 -text "Show busy" -command startBeingBusy
> pack .b1 -padx 40 -pady 40
> 
> button .b2 -text "Show busy" -command beBusy
> pack .b2 -padx 40 -pady 40
> ==================================================================

-- 
Greg McFarlane:    INMS Telstra Australia (gregm at iname.com)
Today's forecast:  Sunny, with occasional cloudy periods and a chance
		   of precipitation in some areas.




More information about the Python-list mailing list