Getting the color of a `wx.StaticBox` on Mac

Hey,

wx.StaticBox on Mac looks pretty good. But when I put some widgets on it, I need to make sure they have a darker background color to match the static box. How do I get the color of the static box? I tried .BackgroundColour on the static box but no luck.

Is it accessible at all in wxPython? Or is it a constant color that I can just hard-code into my app? I’m not very familiar with Mac OS, do they have themes which can change this color?

Thanks,

Ram.

Hey,

`wx.StaticBox` on Mac looks pretty good. But when I put some widgets on
it, I need to make sure they have a darker background color to match the
static box. How do I get the color of the static box? I tried
`.BackgroundColour` on the static box but no luck.

Is it accessible at all in wxPython?

No.

Or is it a constant color that I
can just hard-code into my app?

It will be the color of the static box's parent, adjusted to be slightly darker. I'm not sure if it's documented how to get from the parent's color to the box's color, but you might be able to find something in the Apple docs or with google.

BTW, unless you explicitly set the bg color of your widgets, many of them will already do the right thing and have the correct bg color. For example, native widgets that are meant to appear transparent (like static text or a checkbox) will do the right thing, and so will custom composite widgets that are based on a wx.Panel. Others probably will too.

···

On 7/11/11 11:55 AM, cool-RR wrote:

--
Robin Dunn
Software Craftsman

I should have mentioned that this is for an HtmlWindow, which I assume cannot be transparent.

I will look in the Apple docs for any algorithm that gives the color.

Thanks,

Ram.

···

On Mon, Jul 11, 2011 at 11:15 PM, Robin Dunn robin@alldunn.com wrote:

On 7/11/11 11:55 AM, cool-RR wrote:

Hey,

wx.StaticBox on Mac looks pretty good. But when I put some widgets on

it, I need to make sure they have a darker background color to match the

static box. How do I get the color of the static box? I tried

.BackgroundColour on the static box but no luck.

Is it accessible at all in wxPython?

No.

Or is it a constant color that I

can just hard-code into my app?

It will be the color of the static box’s parent, adjusted to be slightly darker. I’m not sure if it’s documented how to get from the parent’s color to the box’s color, but you might be able to find something in the Apple docs or with google.

BTW, unless you explicitly set the bg color of your widgets, many of them will already do the right thing and have the correct bg color. For example, native widgets that are meant to appear transparent (like static text or a checkbox) will do the right thing, and so will custom composite widgets that are based on a wx.Panel. Others probably will too.

Robin Dunn

I've had this same experience with Mac OS so I just measure the
desired color with the DigitalColor Meter in the Utilities folder. I
often subclass wx.Dialog using panels with groups of widgets in static
boxes. The panels measure rgb=(224,224,224) and the static boxes
measure rgb=(216,216,216). On Linux, I use GIMP for the same
information.

Dan

···

On Jul 11, 2:55 pm, cool-RR <ram.rac...@gmail.com> wrote:

Or is it a constant color that I can
just hard-code into my app?

Thanks Dan.

···

On Tue, Jul 12, 2011 at 2:18 AM, Dan Koch self.dankoch@gmail.com wrote:

I’ve had this same experience with Mac OS so I just measure the

desired color with the DigitalColor Meter in the Utilities folder. I

often subclass wx.Dialog using panels with groups of widgets in static

boxes. The panels measure rgb=(224,224,224) and the static boxes

measure rgb=(216,216,216). On Linux, I use GIMP for the same

information.

Dan

On Jul 11, 2:55 pm, cool-RR ram.rac...@gmail.com wrote:

Or is it a constant color that I can

just hard-code into my app?

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en


Sincerely,
Ram Rachum