I'm working on a GUI for one of my projects (I dislike UI programming, specifically non-web), which will be as basic and simple as possible. I chose Wx, simply because it's a tad bit prettier (than Tk). This UI is being designed for a 5" touch-screen, and doesn't need many features.

I'm wondering with Wx, how I can change the font colour of a simple StaticText (or even a button). The docs are sparse, but even the perl and XS code don't seem to have anything relating to changing colours.

Am I missing something, or is this just the way Wx is? If Tk or (insert suggestion here) can be manipulated to do simple things like change the colour of a font, I'll seriously consider changing to that (to begin with, Wx was a PITA to get set up on a Raspberry Pi, so I'm half-way toward changing as-is).

my $font = Wx::Font->new(16); $self->{t_header} = Wx::StaticText->new( $panel, 1, "Temperature", $self->{xy}{t_header} ); $self->{t_header}->SetFont($font);

update: The code and references to other code in this and subsequent nodes require trunk installs of certain modules. CPAN versions will not have the updates to render things properly...


In reply to 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.