wxBusyCursor()

From what I understood, his error was that BusyCursor wasn't in effect

when he ran EndBusyCursor, so I don't think your solution will get rid
of his error. I could be wrong though!

--vicki

···

-----Original Message-----
From: Uwe C. Schroeder [mailto:uwe@oss4u.com]
Sent: Wednesday, July 28, 2004 3:11 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wxBusyCursor()

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Or you can just check if the window is busy by doing:

if wx.IsBusy():
  wx.EndBusyCursor()

Thus avoiding the error if some other routine already ended
the busy status

On Wednesday 28 July 2004 11:31 am, Stanfield, Vicki >{D167~Indianapolis} >wrote:

Well, you have to make sure you call the wxEndBusyCursor

only when the

wxBeginBusyCursor is running. Think of it like a wrapper. Start the
busy cursor, do something that you want to see the busy cursor for,
and then end the busy cursor. Here is an example as taken from the
demo:

if os.path.exists(itemText + '.py'):
                wx.BeginBusyCursor()
                wx.LogMessage("Running demo %s.py..." % itemText)
                try:
                    self.LoadDemoSource(itemText + '.py')

                    if (sys.modules.has_key(itemText)):
                       reload(sys.modules[itemText])

                    module = __import__(itemText, globals())
                    self.SetOverview(itemText + " Overview",
module.overview)
                finally:
                    wx.EndBusyCursor()
                self.tree.Refresh()

--vicki

  -----Original Message-----
  From: Heimburger, Ralph P [mailto:rpheimburger@babcock.com]
  Sent: Wednesday, July 28, 2004 1:04 PM
  To: wxPython-users@lists.wxwidgets.org
  Subject: RE: [wxPython-users] wxBusyCursor()

  Yes, your solution seems to work visually but now I get

an error in

the console:

  line 28, in workingStatus

      wx.EndBusyCursor()

  line 250, in EndBusyCursor

      return _misc.EndBusyCursor(*args, **kwargs)

  wx.core.PyAssertionError: C++ assertion

"wxAssertFailure" failed in

..\..\src\ms

  w\utilsgui.cpp(176): no matching wxBeginBusyCursor() for
wxEndBusyCursor()

  Ralph Heimburger * Enterprise Systems

  The Babcock & Wilcox Company*20 S. Van Buren Ave.*Barberton, OH
44203*(330) 860-1858

  -----Original Message-----
  From: Stanfield, Vicki {D167~Indianapolis}
[mailto:vicki.stanfield@ROCHE.COM]
  Sent: Wednesday, July 28, 2004 1:48 PM
  To: wxPython-users@lists.wxwidgets.org
  Subject: RE: [wxPython-users] wxBusyCursor()

  I think it should look more like this:

  def workingStatus(self, mode):

  self.statusBar.text=mode

  if mode==;Working':

      wx.BeginBusyCursor()

  else:

      wx.EndBusyCursor()

  But that being said, I've only used this in the demo

code. If this

function doesn't get called at the end of the time you want the Busy
Cursor, you'll want to move the EndBusyCursor call.

  --vicki

    -----Original Message-----
    From: Heimburger, Ralph P
[mailto:rpheimburger@babcock.com]
    Sent: Tuesday, July 27, 2004 12:24 PM
    To: wxPython-users@lists.wxwidgets.org
    Subject: [wxPython-users] wxBusyCursor()

    I wrote a function that I call with "modes". When the
mode is 'Working' I want the cursor to be an hourglass.

    The function is defined as follows:

        def workingStatus (self, mode):

            self.statusBar.text=mode

            if mode=='Working':

               dowait=wx.wxBusyCursor()

                else:

               dowait=None

    When I call the function with this command:
self.workingStatus('Working')

    It updates the StatusText, but does not change the
cursor. Why?

    Ralph Heimburger * Enterprise Systems

    The Babcock & Wilcox Company*20 S. Van Buren

Ave.*Barberton, OH

44203*(330) 860-1858

- --
UC

- --
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFBCAhEjqGXBvRToM4RArYYAJ9LMTiNxZRpByuBr7weih2u4otJegCgoSu6
zyrNfPWUMBgRW27ne3RJAn8=
=NH/Z
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org

You are :slight_smile:
The test will tell you if wx.BusyCursor has been called (thus the window is
busy). I'm using that construct in a quite large application where I had the
same problem, mostly in error handling routines. A generic error handler has
to be able to determine if the window is in a busy state or not. wx.IsBusy
will only return True if wx.BusyCursor has been called prior and
wx.EndBusyCursor has not been called yet. Right after the wx.EndBusyCursor
the wx.IsBusy call will return False.

Uwe

···

On Wednesday 28 July 2004 01:17 pm, Stanfield, Vicki {D167~Indianapolis} wrote:

From what I understood, his error was that BusyCursor wasn't in effect
when he ran EndBusyCursor, so I don't think your solution will get rid
of his error. I could be wrong though!

--vicki

>-----Original Message-----

From: Uwe C. Schroeder [mailto:uwe@oss4u.com]

>Sent: Wednesday, July 28, 2004 3:11 PM
>To: wxPython-users@lists.wxwidgets.org
>Subject: Re: [wxPython-users] wxBusyCursor()
>
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>
>Or you can just check if the window is busy by doing:
>
>if wx.IsBusy():
> wx.EndBusyCursor()
>
>Thus avoiding the error if some other routine already ended
>the busy status
>
>
>
>On Wednesday 28 July 2004 11:31 am, Stanfield, Vicki > >{D167~Indianapolis} > > > >wrote:
>> Well, you have to make sure you call the wxEndBusyCursor
>
>only when the
>
>> wxBeginBusyCursor is running. Think of it like a wrapper. Start the
>> busy cursor, do something that you want to see the busy cursor for,
>> and then end the busy cursor. Here is an example as taken from the
>> demo:
>>
>> if os.path.exists(itemText + '.py'):
>> wx.BeginBusyCursor()
>> wx.LogMessage("Running demo %s.py..." % itemText)
>> try:
>> self.LoadDemoSource(itemText + '.py')
>>
>> if (sys.modules.has_key(itemText)):
>> reload(sys.modules[itemText])
>>
>> module = __import__(itemText, globals())
>> self.SetOverview(itemText + " Overview",
>> module.overview)
>> finally:
>> wx.EndBusyCursor()
>> self.tree.Refresh()
>>
>> --vicki
>>
>> -----Original Message-----
>> From: Heimburger, Ralph P [mailto:rpheimburger@babcock.com]
>> Sent: Wednesday, July 28, 2004 1:04 PM
>> To: wxPython-users@lists.wxwidgets.org
>> Subject: RE: [wxPython-users] wxBusyCursor()
>>
>>
>>
>> Yes, your solution seems to work visually but now I get
>
>an error in
>
>> the console:
>>
>>
>>
>> line 28, in workingStatus
>>
>> wx.EndBusyCursor()
>>
>> line 250, in EndBusyCursor
>>
>> return _misc.EndBusyCursor(*args, **kwargs)
>>
>> wx.core.PyAssertionError: C++ assertion
>
>"wxAssertFailure" failed in
>
>> ..\..\src\ms
>>
>> w\utilsgui.cpp(176): no matching wxBeginBusyCursor() for
>> wxEndBusyCursor()
>>
>>
>>
>> Ralph Heimburger * Enterprise Systems
>>
>> The Babcock & Wilcox Company*20 S. Van Buren Ave.*Barberton, OH
>> 44203*(330) 860-1858
>>
>> -----Original Message-----
>> From: Stanfield, Vicki {D167~Indianapolis}
>> [mailto:vicki.stanfield@ROCHE.COM]
>> Sent: Wednesday, July 28, 2004 1:48 PM
>> To: wxPython-users@lists.wxwidgets.org
>> Subject: RE: [wxPython-users] wxBusyCursor()
>>
>>
>>
>> I think it should look more like this:
>>
>>
>>
>> def workingStatus(self, mode):
>>
>> self.statusBar.text=mode
>>
>> if mode==;Working':
>>
>> wx.BeginBusyCursor()
>>
>> else:
>>
>> wx.EndBusyCursor()
>>
>>
>>
>> But that being said, I've only used this in the demo
>
>code. If this
>
>> function doesn't get called at the end of the time you want the Busy
>> Cursor, you'll want to move the EndBusyCursor call.
>>
>>
>>
>> --vicki
>>
>> -----Original Message-----
>> From: Heimburger, Ralph P
>> [mailto:rpheimburger@babcock.com]
>> Sent: Tuesday, July 27, 2004 12:24 PM
>> To: wxPython-users@lists.wxwidgets.org
>> Subject: [wxPython-users] wxBusyCursor()
>>
>> I wrote a function that I call with "modes". When the
>> mode is 'Working' I want the cursor to be an hourglass.
>>
>> The function is defined as follows:
>>
>>
>>
>> def workingStatus (self, mode):
>>
>> self.statusBar.text=mode
>>
>> if mode=='Working':
>>
>> dowait=wx.wxBusyCursor()
>>
>> else:
>>
>> dowait=None
>>
>>
>>
>> When I call the function with this command:
>> self.workingStatus('Working')
>>
>> It updates the StatusText, but does not change the
>> cursor. Why?
>>
>>
>>
>> Ralph Heimburger * Enterprise Systems
>>
>> The Babcock & Wilcox Company*20 S. Van Buren
>
>Ave.*Barberton, OH
>
>> 44203*(330) 860-1858
>
>- --
> UC
>
>- --
>Open Source Solutions 4U, LLC 2570 Fleetwood Drive
>Phone: +1 650 872 2425 San Bruno, CA 94066
>Cell: +1 650 302 2405 United States
>Fax: +1 650 872 2417
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.3 (GNU/Linux)
>
>iD8DBQFBCAhEjqGXBvRToM4RArYYAJ9LMTiNxZRpByuBr7weih2u4otJegCgoSu6
>zyrNfPWUMBgRW27ne3RJAn8=
>=NH/Z
>-----END PGP SIGNATURE-----
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
>For additional commands, e-mail:
>wxPython-users-help@lists.wxwidgets.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

- --
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417