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