here is what i do:
my $tc = Wx::TextCtrl->new( $window1, -1, '', [450,15], [229,300], wxT +E_READONLY|wxTE_RICH|wxALL); my ( $red, $green ) = ( Wx::Colour->newRGB( 255, 0, 0 ), Wx::Colour->n +ewRGB( 0, 90, 0 ) ); if ( $md5s =~ $md5 ) { my $style = Wx::TextAttr->new(); $style->Wx::TextAttr::SetTextColour($green); $tc->SetStyle( -1, -1, $style ); $tc->WriteText("$file | $filesize\n"); } else { my $style = Wx::TextAttr->new(); $style->Wx::TextAttr::SetTextColour($red); $tc->SetStyle( -1, -1, $style ); $tc->WriteText("$file | $filesize\n"); }

I dont know if that will help much, but maybe it will help enough!

EDIT: I think this is might be for TextCtrl. I am sure you can do it with static text though. I look through my code.

EDIT2: Here I found something:

my $static_text = Wx::StaticText->new( $window, -1, "Current File:", [ + 5, 355 ]); $static_text->SetForegroundColour( Wx::Colour->new(255, 0, 0) );
And it does indeed work. This turned the static text "Current File:" red. Deleting the SetForegroundColour line returns it to black.

In reply to Re: Changing font colour in a Wx StaticText or Button by james28909
in thread Changing font colour in a Wx StaticText or Button by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.