[wxPython] Updating the status bar?

Discussion in 'Python' started by Steve Lamb, Aug 11, 2003.

  1. Steve Lamb

    Steve Lamb Guest

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

    Ok, this one I did try before coming here... :)

    I am trying to report the status of what is going on to the status
    bar of the main window of my wxPython app. I know I'm on the right
    track with SetStatusText() but it doesn't always alter the text. What
    the program is doing is taking a filename and passing it through two
    different external programs. One of them is taking a little bit of time
    to process the file (sa-learn) so the user needs to know what is going
    on. Right now I have the call to update the status bar preceding the
    external call like so:

    self.MainStatus.SetStatusText('Reporting message as spam.',0)
    code = os.system("%s '%s'" % (vars.razor_spam, filepath))

    The status bar is not being updated. I know it works because other
    calls I have to the same method work fine. Is there some call I need to
    make to refresh the window or at least the status bar?

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (GNU/Linux)

    iD8DBQE/Nxw5el/srYtumcURAkUaAKCsZep0u8rjIalqXYJ4+8BbeqmdVgCfRbYx
    3vIlOU4xsEXlLQI5+3Q74Dc=
    =4EQS
    -----END PGP SIGNATURE-----

    --
    Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
    PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
    | -- Lenny Nero - Strange Days
    -------------------------------+---------------------------------------------
    Steve Lamb, Aug 11, 2003
    #1
    1. Advertising

  2. Steve Lamb wrote in news::

    > Ok, this one I did try before coming here... :)
    >
    > I am trying to report the status of what is going on to the status
    > bar of the main window of my wxPython app. I know I'm on the right
    > track with SetStatusText() but it doesn't always alter the text. What
    > the program is doing is taking a filename and passing it through two
    > different external programs. One of them is taking a little bit of
    > time to process the file (sa-learn) so the user needs to know what is
    > going on. Right now I have the call to update the status bar
    > preceding the external call like so:
    >
    > self.MainStatus.SetStatusText('Reporting message as
    > spam.',0) code = os.system("%s '%s'" % (vars.razor_spam,
    > filepath))
    >
    > The status bar is not being updated. I know it works because
    > other calls I have to the same method work fine. Is there some
    > call I need to make to refresh the window or at least the status
    > bar?


    From the wxWindows help file:

    wxWindow::Update
    virtual void Update()

    Calling this method immediately repaints the invalidated area of the
    window while this would usually only happen when the flow of control
    returns to the event loop. Notice that this function doesn't refresh the
    window and does nothing if the window hadn't been already repainted. Use
    Refresh first if you want to immediately redraw the window
    unconditionally.

    So I would guess at:

    self.MainStatus.Refresh()
    self.MainStatus.Update()

    HTH

    Rob.
    --
    http://www.victim-prime.dsl.pipex.com/
    Rob Williscroft, Aug 11, 2003
    #2
    1. Advertising

  3. Steve Lamb

    Cliff Wells Guest

    On Fri, 2003-08-15 at 13:06, Steve Lamb wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > On 11 Aug 2003 05:32:10 GMT, Rob Williscroft <> wrote:
    > > So I would guess at:

    >
    > > self.MainStatus.Refresh()
    > > self.MainStatus.Update()

    >
    > Finally got around to trying this and no dice. Still does not
    > update the status bar at all. :/


    Try adding a wxYield() after the Update(). The Refresh() probably isn't
    necessary.

    Regards,

    --
    Cliff Wells, Software Engineer
    Logiplex Corporation (www.logiplex.net)
    (503) 978-6726 (800) 735-0555
    Cliff Wells, Aug 15, 2003
    #3
  4. Steve Lamb

    Steve Lamb Guest

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

    On Fri, 15 Aug 2003 14:09:50 -0700, Cliff Wells <> wrote:
    > Try adding a wxYield() after the Update(). The Refresh() probably isn't
    > necessary.


    That did it. Thanks much!

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.2 (GNU/Linux)

    iD8DBQE/PZ39el/srYtumcURAvuXAKCVKQ9LNLzCc+b3lP4j4x4tWrd9VgCfSrFv
    IDikEMBsT5n9MKKVygYawi4=
    =NYX+
    -----END PGP SIGNATURE-----

    --
    Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
    PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
    | -- Lenny Nero - Strange Days
    -------------------------------+---------------------------------------------
    Steve Lamb, Aug 16, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    0
    Views:
    3,527
  2. John Hann
    Replies:
    0
    Views:
    6,047
    John Hann
    Aug 21, 2004
  3. Matt
    Replies:
    9
    Views:
    70,773
  4. Matt
    Replies:
    9
    Views:
    529
    kaeli
    Aug 23, 2004
  5. topmind
    Replies:
    1
    Views:
    333
    Bart Van der Donck
    Jul 1, 2006
Loading...

Share This Page