Color of wx.StaticLine

I apologize in advance for what for another newbie (and probably dumb) question…

If I have a wx.StaticLine, is it possible to control its color?

I tried to search for an answer, but I don’t seem to find any results on point, and I am still having trouble wading thru the documentation.

Thank you for you time and patience.

Regards,

Russ

Hi,

···

On Feb 24, 2010, at 7:23 AM, R. P. Hintze wrote:

I apologize in advance for what for another newbie (and probably dumb) question…

If I have a wx.StaticLine, is it possible to control its color?

I tried to search for an answer, but I don’t seem to find any results on point, and I am still having trouble wading thru the documentation.

Have you tried staticLine.SetForegroundColour(some_colour)?

Cody

It's up to the native widget whether it does anything with Set[Back|Fore]groundColour, and as far as I know none of the platforms do for wx.StaticLine. You can do it with a generic control where you draw the lines yourself.

···

On 2/24/10 5:23 AM, R. P. Hintze wrote:

I apologize in advance for what for another newbie (and probably dumb)
question...
If I have a wx.StaticLine, is it possible to control its color?

--
Robin Dunn
Software Craftsman

Yes, I was playing around with Set[Back|Fore]groundColour (I am using
WindowsXP), and the color of the wx.StaticLine does not change.

I will look into how one draws a line...

As a practical exercise (in learning python and wxpython), I am trying
to write a program that my little girl can use to learn/re-enforce
math facts. The program will show random "problems" - such as, "13 +
6" - as a statictext, and she will enter the answer (key pad will be
displayed for mouse or she can use keyboard). I wanted the "problem"
to be presented as:

13
+ 6

With the " 6" underlined and with a text control beneath the underline
for her to enter her answer. I have formatted the "problem" with the
following code:

        self.num_one = 13
        self.num_two = 6
        self.problem = "{0: >2}\n{1: >2}".format(self.num_one,
self.num_two)

In the actual program, self.num_one and self.num_two will be randomly
generated. I am struggling on how to add the underline. I guess I
could break self.num_one and self.num_two into 2 statictext widgets,
and apply a different font to self.num_two - which set "underline" as
"TRUE"? I thought that there should be an easier way.

···

On Feb 24, 8:31 pm, Robin Dunn <ro...@alldunn.com> wrote:

It's up to the native widget whether it does anything with
Set[Back|Fore]groundColour, and as far as I know none of the platforms
do for wx.StaticLine. You can do it with a generic control where you
draw the lines yourself.

You could use a small HtmlWindow. That would give you quite a few more
options, although it doesn't support advanced HTML or CSS, you could
do a one column table along with <u/> or whatever.

Alternatively, you might look at some of the styled text controls,
like RichTextCtrl or StyleTextCtrl.

···

On Feb 25, 6:24 am, gatoruss <rphin...@earthlink.net> wrote:

On Feb 24, 8:31 pm, Robin Dunn <ro...@alldunn.com> wrote:

> It's up to the native widget whether it does anything with
> Set[Back|Fore]groundColour, and as far as I know none of the platforms
> do for wx.StaticLine. You can do it with a generic control where you
> draw the lines yourself.

Yes, I was playing around with Set[Back|Fore]groundColour (I am using
WindowsXP), and the color of the wx.StaticLine does not change.

I will look into how one draws a line...

As a practical exercise (in learning python and wxpython), I am trying
to write a program that my little girl can use to learn/re-enforce
math facts. The program will show random "problems" - such as, "13 +
6" - as a statictext, and she will enter the answer (key pad will be
displayed for mouse or she can use keyboard). I wanted the "problem"
to be presented as:

13
+ 6

With the " 6" underlined and with a text control beneath the underline
for her to enter her answer. I have formatted the "problem" with the
following code:

    self\.num\_one = 13
    self\.num\_two = 6
    self\.problem = &quot;\{0: &gt;2\}\\n\{1: &gt;2\}&quot;\.format\(self\.num\_one,

self.num_two)

In the actual program, self.num_one and self.num_two will be randomly
generated. I am struggling on how to add the underline. I guess I
could break self.num_one and self.num_two into 2 statictext widgets,
and apply a different font to self.num_two - which set "underline" as
"TRUE"? I thought that there should be an easier way.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org