[wxPython] Updating the status bar?

S

Steve Lamb

-----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-----
 
R

Rob Williscroft

Steve Lamb wrote in
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.
 
C

Cliff Wells

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




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,
 
S

Steve Lamb

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

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-----
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top