This is one of those areas where Gtk2's theme engine makes things tricky. Here are a couple of self-explanatory examples.
#!/usr/bin/perl use warnings; use strict; use Gtk2 '-init'; #the Entry settings in ~/.gtkrc-2.0 dosn't #seem to do anything except create a subtle outline #under the entry box. So you need to manually make one. Gtk2::Rc->parse_string(<<__); #include "/usr/local/share/themes/Bumblebee/gtk-2.0/gtkrc" style "normal" { font_name ="serif 30" } style "my_entry" { font_name ="sans 25" text[NORMAL] = "#FF0000" text[INSENSITIVE] = "#555555" } widget "*" style "normal" widget "*Entry*" style "my_entry" __ my $window = Gtk2::Window->new; $window->set_title("Hello world"); $window->signal_connect( destroy => sub { Gtk2->main_quit; } ); my $vbox = Gtk2::VBox->new(); $vbox->set( "border_width" => 10 ); $window->add($vbox); my $label = Gtk2::Label->new("ועפשץי"); $vbox->pack_start( $label, 0, 0, 5 ); # expand?, fill?, padding my $entry = Gtk2::Entry->new(); $vbox->pack_start( $entry, 0, 0, 5 ); my $button = Gtk2::Widget->new( "Gtk2::Button", label => "Set Insensit +ive" ); $button->signal_connect( clicked => sub { $entry->set_state('insensiti +ve') } ); my $button1 = Gtk2::Widget->new( "Gtk2::Button", label => "Quit" ); $button1->signal_connect( clicked => sub { Gtk2->main_quit; } ); $vbox->pack_start( $button, 0, 0, 5 ); $vbox->pack_start( $button1, 0, 0, 5 ); $window->show_all(); Gtk2->main;
#!/usr/bin/perl use warnings; use strict; use Gtk2 '-init'; #the Entry settings in ~/.gtkrc-2.0 dosn't #seem to do anything except create a subtle outline #under the entry box. So you need to manually make one. Gtk2::Rc->parse_string(<<__); include "/usr/local/share/themes/Bumblebee/gtk-2.0/gtkrc" style "normal" { font_name ="serif 30" } style "my_entry" { font_name ="sans 25" text[NORMAL] = "#FF0000" } widget "*" style "normal" widget "*Entry*" style "my_entry" __ my $window = Gtk2::Window->new; $window->set_title("Hello world"); $window->signal_connect( destroy => sub { Gtk2->main_quit; } ); my $vbox = Gtk2::VBox->new(); $vbox->set( "border_width" => 10 ); $window->add($vbox); my $label = Gtk2::Label->new("ועפשץי"); $vbox->pack_start( $label, 0, 0, 5 ); # expand?, fill?, padding my $entry = Gtk2::Entry->new(); $vbox->pack_start( $entry, 0, 0, 5 ); my $button = Gtk2::Widget->new( "Gtk2::Button", label => "Quit" ); $button->signal_connect( clicked => sub { Gtk2->main_quit; } ); my $button1 = Gtk2::Widget->new( "Gtk2::Button", label => "Toggle Entr +y Color" ); $button1->signal_connect( clicked => sub { my ( $red, $green, $blue, $color); ( $red, $green, $blue) = (int rand 65535, int rand 65535,int ra +nd 65535 ); $color = Gtk2::Gdk::Color->new ( $red, $green, $blue); $entry->modify_text ( 'GTK_STATE_NORMAL', $color); $entry->set_text ("$red $green $blue" ); } ); $vbox->pack_start( $button, 0, 0, 5 ); $vbox->pack_start( $button1, 0, 0, 5 ); $window->show_all(); Gtk2->main;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: Gtk2::Entry - how to desensitise by zentara
in thread Gtk2::Entry - how to desensitise by aslewis

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.