How to update status bar in wxPython?

Steven Sartorius ssartor at bellatlantic.net
Wed Mar 28 13:15:29 EST 2001


I'm a newbie to GUI programming in general so apologies if this is a FAQ....

I've got a Python script that does some heavy duty number crunching and file
I/O.  To track the progress of the script I print a series of messages to the
console/x-term ("Working on file #....", etc,etc).  As a project, I decided to
guify the script with wxPython and Boa-constructor.  I've successfully built a
window with a single button, a couple of text input fields and a status bar;
clicking the button fires off the script.  What I'm trying to do (so far
unsuccessfully) is redirect the progress messages from the console to the
status bar on the window.  Because I'm retrofitting an existing script, I've
just replaced the original 'print' statements with
'statusBar.SetStatusText("Working on file....") and (for good measure)
'statusBar.Refresh()'.  This approach kind of works....the status bar shows
the final progress message ("All data processed")  but only after I force the
window to redraw (moving it or covering and then uncovering it).  I'm sure I'm
missing something basic here so any help would be much appreciated.

Thanks,

Steve



More information about the Python-list mailing list