[wxPython] How to change the mouse pointer to hourglass and back.

797 views
Skip to first unread message

William Voll

unread,
Jul 8, 2001, 5:00:22 PM7/8/01
to wxpytho...@lists.wxwindows.org
Hi All,

I was looking for some help on changing the mouse pointer from normal to an
hourglass while my app does some processing then setting it back to normal
when it is done.

I have tried self.SetCursor(wxCURSOR_WAIT) but I get this traceback:

Traceback (most recent call last):
File "wxFrameDocuParse.py", line 118, in OnBtnparseButton
self.SetCursor(wxCURSOR_WAIT)
File "c:\python21\wxPython\windows.py", line 418, in SetCursor
val = apply(windowsc.wxWindow_SetCursor,(self,) + _args, _kwargs)
TypeError: Type error in argument 2 of wxWindow_SetCursor. Expected
_wxCursor_p.

Thanks,

--zDweeB

.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.
ASCII art?? I thought it was a regular expression!

Patricia Hawkins

unread,
Jul 8, 2001, 5:56:11 PM7/8/01
to wxpytho...@lists.wxwindows.org
At start of process:
busy = wxBusyCursor()

and at end:
del busy

HOWEVER, this works a lot better on Windows than on Linux. For some
reason, on Linux, the cursor doesn't change until the process is
almost done, which means the user is left clueless with an apparently
frozen app for quite some time.

Anyone know a fix?

>>>>> "WV" == William Voll <zdw...@hotmail.com> writes:

WV> Hi All,

WV> I was looking for some help on changing the mouse pointer from normal to an
WV> hourglass while my app does some processing then setting it back to normal
WV> when it is done.


Riaan Booysen

unread,
Jul 9, 2001, 9:40:52 AM7/9/01
to wxpytho...@lists.wxwindows.org
Hello William,

I use the following pattern:

wxBeginBusyCursor()
try:
# whatever
finally:
wxEndBusyCursor()

> _______________________________________________
> wxpython-users mailing list
> wxpytho...@lists.wxwindows.org
> http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Riaan Booysen
___________________________________________________
Boa Constructor - RAD GUI building IDE for wxPython
http://boa-constructor.sourceforge.net

Patricia Hawkins

unread,
Jul 9, 2001, 1:44:16 PM7/9/01
to wxpytho...@lists.wxwindows.org
>>>>> "RD" == Robin Dunn <ro...@alldunn.com> writes:

>> HOWEVER, this works a lot better on Windows than on Linux. For some
>> reason, on Linux, the cursor doesn't change until the process is
>> almost done, which means the user is left clueless with an apparently
>> frozen app for quite some time.

RD> A lot of the UI updates on wxGTK don't actually happen until the app is
RD> idle. This is an optimizations to help reduce flicker, redundant updating,
RD> etc.

>> Anyone know a fix?

RD> As Mike said, try wxYield or wxSafeYield.

Thanks, wxYield did the trick.

--Patricia


Robin Dunn

unread,
Jul 9, 2001, 12:46:44 PM7/9/01
to wxpytho...@lists.wxwindows.org
>
> I was looking for some help on changing the mouse pointer from normal to
an
> hourglass while my app does some processing then setting it back to
normal
> when it is done.
>
> I have tried self.SetCursor(wxCURSOR_WAIT) but I get this traceback:
>

This form of the constructor is called wxStockCursor, but for just doing
temporary busy cursors there are easier ways to do it, as others have
already shown.

--
Robin Dunn
Software Craftsman
ro...@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Robin Dunn

unread,
Jul 9, 2001, 12:46:47 PM7/9/01
to wxpytho...@lists.wxwindows.org
> HOWEVER, this works a lot better on Windows than on Linux. For some
> reason, on Linux, the cursor doesn't change until the process is
> almost done, which means the user is left clueless with an apparently
> frozen app for quite some time.

A lot of the UI updates on wxGTK don't actually happen until the app is


idle. This is an optimizations to help reduce flicker, redundant updating,

etc.

> Anyone know a fix?

As Mike said, try wxYield or wxSafeYield.

--

William Voll

unread,
Jul 9, 2001, 8:20:48 PM7/9/01
to wxpytho...@lists.wxwindows.org
Hi everyone I tried Riaan's example:

wxBeginBusyCursor()
try:
# whatever
finally:
wxEndBusyCursor()

It worked just fine :)

BTW Great job on BOA Riaan!

Mike C. Fletcher

unread,
Jul 9, 2001, 1:17:34 AM7/9/01
to wxpytho...@lists.wxwindows.org
What about calling wxYeild() to let the window process pending events? No
idea if it would work, but might be worth a try.

HTH,
Mike

Anyone know a fix?

WV> Hi All,

Reply all
Reply to author
Forward
0 new messages