Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Changing font colour in a Wx StaticText or Button

by stevieb (Canon)
on Aug 28, 2016 at 23:25 UTC ( [id://1170637]=note: print w/replies, xml ) Need Help??


in reply to Re: Changing font colour in a Wx StaticText or Button
in thread Changing font colour in a Wx StaticText or Button

I quiver when I think that my more elaborate distributions aren't clear in their documentation... (that said, I realize that this is a *massive* undertaking, wrapping over all of Wx).

I can't find any documentation or examples of "how-to" extending a class or doing what I want, so I think I'll contact the author to see. I didn't want to spend a whole day writing a little gui app.

Is Wx the way to go in Perl for GUI? Tk looks like it has much better documentation. Despite that it doesn't look as nice (realistically, that won't matter to me), the fact that it is far more prevalent and apparently wider-used, I might start over with it.

My goals for the GUI are ensure functionality with the back-end actions, ease of writing, ease of changes, ease of "I need to do this..." type searches.

  • Comment on Re^2: Changing font colour in a Wx StaticText or Button

Replies are listed 'Best First'.
Re^3: Changing font colour in a Wx StaticText or Button
by beech (Parson) on Aug 29, 2016 at 01:52 UTC

    um ... I like sweaters

    #!/usr/bin/perl -- use strict; use warnings; use Wx qw/ :allclasses /; my $frame = Wx::Frame->new( undef, -1, "statictext color change" ); $frame->{panel} = Wx::Panel->new( $frame ); $frame->{button} = Wx::Button->new( $frame->{panel} , -1, "Toggle", ) +; $frame->{static} = Wx::StaticText->new( $frame->{panel}, -1, "I am co +lorful" ); $frame->{sizer} = Wx::BoxSizer->new( Wx::wxVERTICAL() ); $frame->{panel}->SetSizer( $frame->{sizer} ); $frame->{sizer}->Add( $frame->{button} ); $frame->{sizer}->AddSpacer(100); $frame->{sizer}->Add( $frame->{static} ); Wx::Event::EVT_BUTTON( $frame, $frame->{button}, \&button_click, ); $frame->Show; Wx::SimpleApp->new->MainLoop; exit( 0 ); sub button_click { my( $frame, $event ) = @_; $frame->{hit}++; my $static = $frame->{static}; my $color = $static->GetForegroundColour; my $label = $static->GetLabel; $label =~ s/ ## .*$//; $label .= " ## ".localtime; $static->SetLabel( $label ); if( $frame->{hit} % 2 ){ $static->SetForegroundColour( Wx::wxBLUE() ); } else { $static->SetForegroundColour( Wx::wxRED() ); } $static->Update; }
Re^3: Changing font colour in a Wx StaticText or Button
by james28909 (Deacon) on Aug 28, 2016 at 23:58 UTC
    I have a program I written in wx and it works freaking great. I change color of the text depending on its md5 value in list box and statictext i think. let me see if I can find the script and see if I have something that can help.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1170637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found