Changing the colour of the wxGauge

Many thanks to Tim Hochberg and Jeff Shannon for answering my questions on faking wxEvents. I am encouraged enough to think I am on the right track, and will press on.

I am now porting the PyUnit GUI from TkInter to wxPython, and have encountered a small problem. The standard behaviour for any xUnit GUI is for the progress bar that shows the tests being run to start off green, then change to red as soon as a test fails. I am using a wxGauge for the progress bar, but I can't find a way of changing the colour of the bar. I have tried SetForegroundColour and SetBackgroundColour, but the bar stays resolutely green.

Is there any way to change the colour of the progress bar, or is this not implemented in wxPython?

BTW, I am using wxPython 2.4.0.7 on Python 2.2.2 and Windows XP.

Regards,

Dave Kirby - The Developers' Coach
Helping software professionals and teams achieve peak performance

email: dave@thedeveloperscoach.com
UK Phone: 020 8376 2274
International Phone: (+44) 20 8376 2274
web: http://www.thedeveloperscoach.com - sign up for my new free eZine, The Agile Life

Dave Kirby wrote:

Many thanks to Tim Hochberg and Jeff Shannon for answering my questions on faking wxEvents. I am encouraged enough to think I am on the right track, and will press on.

I am now porting the PyUnit GUI from TkInter to wxPython, and have encountered a small problem. The standard behaviour for any xUnit GUI is for the progress bar that shows the tests being run to start off green, then change to red as soon as a test fails. I am using a wxGauge for the progress bar, but I can't find a way of changing the colour of the bar. I have tried SetForegroundColour and SetBackgroundColour, but the bar stays resolutely green.

Is there any way to change the colour of the progress bar, or is this not implemented in wxPython?

BTW, I am using wxPython 2.4.0.7 on Python 2.2.2 and Windows XP.

Since there is a native control involved in this case it is up to it (and the @#$#!#@ XP theme engine for your box) to support it, so probably not. It shouldn't be too hard to write a generic progress bar though. Or perhaps you should have another control in addition to the gauge that is used to show the state of the tests, (an image of a traffic light in various states, for example.)

ยทยทยท

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