SetBackgroundColour of StaticText fails on 2.5.2.8 @ SuSE9.1

As the sample code, see the StaticText demo, when it shows the question "Is
this yellow?". In a SuSE9.1, with 2.5.2.8, the background is gray. But I
have some older installs, with older wxPython (2.4.2.4, I guess), in which
StaticText.SetBackgroundColour() worked.

I use this background color change to signal some alarm conditions, so, as a
workaround, in order to my code work in both wxPython versions, I created a
small panel behind the StaticText and change the colour of this panel too.
But this is a bug, isn't?

Ivan

I do the same thing.
It works fine here, both in the demo and in my code.
Win2K, Python 2.3.2, wxPython 2.5.2.8.

It *would* be nice if calling SetBackgroundColour(wx.NullColour)
consistently set the widget back to its default color, though,
as the docs indicate. Instead, for e.g. TextCtrls it sets it to
the default gray instead of the white they start out with.

- Sam

···

At 2004-10-21 11:24 AM -0300, you wrote:

As the sample code, see the StaticText demo, when it shows the question "Is
this yellow?". In a SuSE9.1, with 2.5.2.8, the background is gray. But I
have some older installs, with older wxPython (2.4.2.4, I guess), in which
StaticText.SetBackgroundColour() worked.

I use this background color change to signal some alarm conditions, so, as a
workaround, in order to my code work in both wxPython versions, I created a
small panel behind the StaticText and change the colour of this panel too.
But this is a bug, isn't?

Ivan

__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446
http://SpinwardStars.com/ sam@SpinwardStars.com

2.5.2.8 @ SuSE9.1

>As the sample code, see the StaticText demo, when it shows the question

"Is

>this yellow?". In a SuSE9.1, with 2.5.2.8, the background is gray. But I
>have some older installs, with older wxPython (2.4.2.4, I guess), in

which

>StaticText.SetBackgroundColour() worked.
>
>I use this background color change to signal some alarm conditions, so,

as a

>workaround, in order to my code work in both wxPython versions, I created

a

>small panel behind the StaticText and change the colour of this panel

too.

>But this is a bug, isn't?
>
>Ivan

I do the same thing.
It works fine here, both in the demo and in my code.
Win2K, Python 2.3.2, wxPython 2.5.2.8.

It *would* be nice if calling SetBackgroundColour(wx.NullColour)
consistently set the widget back to its default color, though,
as the docs indicate. Instead, for e.g. TextCtrls it sets it to
the default gray instead of the white they start out with.

- Sam

I do the same thing.
It works on win XP but not on Linux RH9
both with Python 2.3 and wx 2.5.2.8

O.R.

···

----- Original Message -----
From: "Samuel Reynolds" <sam@SpinwardStars.com>
To: <wxPython-users@lists.wxwidgets.org>
Sent: Thursday, October 21, 2004 5:46 PM
Subject: Re: [wxPython-users] SetBackgroundColour of StaticText fails on

At 2004-10-21 11:24 AM -0300, you wrote:

__________________________________________________________
Spinward Stars, LLC Samuel Reynolds
Software Consulting and Development 303-805-1446
http://SpinwardStars.com/ sam@SpinwardStars.com

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Ivan Nazarenko wrote:

As the sample code, see the StaticText demo, when it shows the question "Is this yellow?". In a SuSE9.1, with 2.5.2.8, the background is gray. But I have some older installs, with older wxPython (2.4.2.4, I guess), in which StaticText.SetBackgroundColour() worked.

I didn't think that this has ever worked on the native wx.StaticText control, because in wxGTK it is not a real window but is just drawn on the parent window. There have been some changes in wxGTK to how the styles are applied to the widgets to make them conform better to the active theme and to handle these things more correctly according to the gtk docs. Perhaps there was a hack that made it work in 2.4 that got removed when these changes were done...

Anyway, look at the StaticText module in the demo. There is a USE_GENERIC flag that will change the control used to one that does support SetBackgroundColour. You should be able to use it in your apps in place of the wx.StaticText.

···

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

Samuel Reynolds wrote:

It *would* be nice if calling SetBackgroundColour(wx.NullColour)
consistently set the widget back to its default color, though,
as the docs indicate. Instead, for e.g. TextCtrls it sets it to
the default gray instead of the white they start out with.

Please enter a "wxMSW specific" bug report about this.

···

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

YES!!! Thanks :slight_smile:

Ivan

···

On Thursday 21 October 2004 16:16, Robin Dunn wrote:

Anyway, look at the StaticText module in the demo. There is a
USE_GENERIC flag that will change the control used to one that does
support SetBackgroundColour. You should be able to use it in your apps
in place of the wx.StaticText.