can't change StatusBar ForeGround color

Debian sid
wx2.8 V. 2.8.12.1-3

STATUSBAR_COLORS_BG_ok_FG_wtf_TEST.py (1.43 KB)

···

============

Hi list,

I'm trying to change the FG color into a status bar but no success
(BG work correctly).
Is there a workaround? (or am I missing something?)

JY
--
Roumanian-Yiddish cooking has killed more Jews than Hitler.
    -- Zero Mostel

This Google Groups - wxpython-users Topic may be revelent to you.

Attempts to change wx.StatusBar.BackgroundColour
http://groups.google.com/group/wxpython-users/browse_thread/thread/57ab4d9df913b5fb

Thanks, but my PB seems to have a different origin than described.

StatusBar possess 2 methods: GetBackgroundColour() & SetBackgroundColour(),
so, in my opinion they should work both (otherwise why are they here?)

Furthermore, my changes are taken in account as
  print("SB BG = %s" % self.statusBar.GetBackgroundColour())
  print("SB FG = %s" % self.statusBar.GetForegroundColour())
after the change returns:
  SB BG = (255, 0, 0, 255)
  SB FG = (0, 0, 255, 255)
(I changed my example colors to BG=RED & FG=BLUE)

The whole thing don't have a terrific importance as the more important
for me is to change the background, so user can't forget he is in
a different mode - but I'd like to know if it is a real bug or not.

···

On Sun, 27 Nov 2011 16:18:36 -0800 (PST) DevPlayer <devplayer@gmail.com> wrote:

This Google Groups - wxpython-users Topic may be revelent to you.

Attempts to change wx.StatusBar.BackgroundColour
http://groups.google.com/group/wxpython-users/browse_thread/thread/57ab4d9df913b5fb

--
The words fly away, the writings remain.

Debian sid
wx2.8 V. 2.8.12.1-3

Hi list,

I'm trying to change the FG color into a status bar but no success
(BG work correctly).

Sometimes the native widgets just do not support all the features. This is probably one of those cases. I think setting the fg color of the status bar also doesn't work on Windows.

Is there a workaround? (or am I missing something?)

You could make your own statusbar-like widget. Or you could catch the EVT_PAINT for the statusbar and draw the text yourself.

···

On 11/26/11 4:21 PM, Jean-Yves F. Barbier wrote:

--
Robin Dunn
Software Craftsman

Sometimes the native widgets just do not support all the features. This
is probably one of those cases. I think setting the fg color of the
status bar also doesn't work on Windows.

I can understand that, but in this case why does the function exists
if does nothing?

> Is there a workaround? (or am I missing something?)

You could make your own statusbar-like widget. Or you could catch the
EVT_PAINT for the statusbar and draw the text yourself.

As I said earlier, the question was rhetoric (but not frustration
free) as painting the BG is sufficient for this particular need.

JY

···

On Tue, 29 Nov 2011 11:30:18 -0800 Robin Dunn <robin@alldunn.com> wrote:
--
A woman employs sincerity only when every other form of deception
has failed. -- Scott

This Google Groups - wxpython-users Topic may be revelent to you.

Attempts to change wx.StatusBar.BackgroundColour
http://groups.google.com/group/wxpython-users/browse_thread/thread/57ab4d9df913b5fb

Thanks, but my PB seems to have a different origin than described.

StatusBar possess 2 methods: GetBackgroundColour()& SetBackgroundColour(),
so, in my opinion they should work both (otherwise why are they here?)

The methods are inherited from wx.Window, but it is still up to the native widget whether or not it will do anything when it is told to change the colors.

but I'd like to know if it is a real bug or not.

Not. Little inconsistencies like this are something you just have to live with when using native widgets. Most of the time however they are when trying to do things that are nonstandard so it's not too big of a problem.

···

On 11/27/11 5:11 PM, Jean-Yves F. Barbier wrote:

On Sun, 27 Nov 2011 16:18:36 -0800 (PST) > DevPlayer<devplayer@gmail.com> wrote:

--
Robin Dunn
Software Craftsman

Jean-Yves F. Barbier wrote:

···

On Tue, 29 Nov 2011 11:30:18 -0800 > Robin Dunn <robin@alldunn.com> wrote:

Sometimes the native widgets just do not support all the features. This
is probably one of those cases. I think setting the fg color of the
status bar also doesn't work on Windows.

I can understand that, but in this case why does the function exists
if does nothing?

Just because it does nothing on Windows does not mean that it does
nothing on X. The platforms that wx supports do not support identical
feature sets.

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Because it is inherited from the base class which has a generic implementation that works for some widgets and doesn't for others. If the native statusbar ever does decide to allow it's fg color to be changed then wx.StatusBar will already support it because the common base class implementation is already present. We do not have code anything like this:

     ...
     elif widgetClass == 'foo' and platform == 'bar' \
           and toolKitVersion == 25:
         doNothing()
     elif widgetClass == 'foo' and platform == 'bar' \
           and toolKitVersion == 26:
          doSomething()
     elif ...

We just do:

     doSomething()

and the native widget either does something or it ignores it.

···

On 11/29/11 11:42 AM, Jean-Yves F. Barbier wrote:

On Tue, 29 Nov 2011 11:30:18 -0800 > Robin Dunn<robin@alldunn.com> wrote:

Sometimes the native widgets just do not support all the features. This
is probably one of those cases. I think setting the fg color of the
status bar also doesn't work on Windows.

I can understand that, but in this case why does the function exists
if does nothing?

--
Robin Dunn
Software Craftsman

Because it is inherited from the base class which has a generic
implementation that works for some widgets and doesn't for others. If
the native statusbar ever does decide to allow it's fg color to be
changed then wx.StatusBar will already support it because the common
base class implementation is already present.

Ok, I see better now.

As I understand that, it mean that the only usable
styles/events/props/methods are the one listed in page such as:
wxPython API Documentation — wxPython Phoenix 4.2.2 documentation (?)

We do not have code anything like this:

     ...
     elif widgetClass == 'foo' and platform == 'bar' \
           and toolKitVersion == 25:
         doNothing()
     elif widgetClass == 'foo' and platform == 'bar' \
           and toolKitVersion == 26:
          doSomething()
     elif ...

We just do:

     doSomething()

and the native widget either does something or it ignores it.

I hope so :slight_smile:

···

On Tue, 29 Nov 2011 11:54:16 -0800 Robin Dunn <robin@alldunn.com> wrote:

--

No. As you've seen SetBackgroundColour does work, as well as a few dozen other things inherited from the base classes. The things listed in the docs are essentially just the methods added to that class which don't exist in the base classes.

···

On 11/29/11 12:21 PM, Jean-Yves F. Barbier wrote:

On Tue, 29 Nov 2011 11:54:16 -0800 > Robin Dunn<robin@alldunn.com> wrote:

Because it is inherited from the base class which has a generic
implementation that works for some widgets and doesn't for others. If
the native statusbar ever does decide to allow it's fg color to be
changed then wx.StatusBar will already support it because the common
base class implementation is already present.

Ok, I see better now.

As I understand that, it mean that the only usable
styles/events/props/methods are the one listed in page such as:
wxPython API Documentation — wxPython Phoenix 4.2.2 documentation (?)

--
Robin Dunn
Software Craftsman

There is a 3rd party package that I think supports setting the FG color: EnhancedStatusBar, found here: http://xoomer.virgilio.it/infinity77/main/EnhancedStatusBar.html

I don’t know why that widget isn’t included in the standard distribution yet, but whatever. Give it a whirl and see if it works.

···

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hi Mike,

There is a 3rd party package that I think supports setting the FG color:
EnhancedStatusBar, found here:
http://xoomer.virgilio.it/infinity77/main/EnhancedStatusBar.html

EnhancedStatusBar is unfortunately nothing more than a wx.StatusBar in
disguise, so it will not support out of the box things that the
default wx.StatusBar doesn't support. However, it allows you to get as
fancy as you can by adding (almost) any kind of widgets to it with
relatively little effort as the sizing/positioning of widgets in the
status bar is automatically handled by EnhancedStatusBar itself.

That being said, the OP question is easily solved if he can add a
wx.StaticText to the status bar: this static text will support
background and foreground colours: problem solved. He can of course
use EnhancedStatusBar to do that, although doing a simple thing like
this with wx.StatusBar is relatively easy.

I don't know why that widget isn't included in the standard distribution
yet, but whatever. Give it a whirl and see if it works.

EnhancedStatusBar is not in AGW because I thought it wasn't worth
including it, mostly because no one (that I know of) is using it and
there are some features (like changing the status bar height) that
were not supported by all platforms back in 2007 (GTK was one). I will
of course change my mind if there is any request to include
EnhancedStatusBar into AGW.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 29 November 2011 22:02, Mike Driscoll wrote:

BTW most of what was re-iterated here by Robin and others was also
what they told me in the URL reply I supplied initially.