Re: text attributes



On Mon, 7 Apr 2008 11:44:38 -0500
"Jim Donoghue" <jdonoghue04 gmail com> wrote:

How does one set the default attributes for the widgets such as the text
entry, etc? The default for the 'insensitive' mode on my system is currently
dark gray text on a light gray background, I want to change it to something
I can actually read. This is on a Slackware 11 installation with KDE. The
previous system I had used this application on was RedHat, and the text when
'insensitive' was black on gray.

Are you talking about a TextView widget or an Entry widget?

Usually the ./gtkrc-2.0 file sets the style for all widgets, but you can
override the default style in a custom manner in a single script.
Assuming you are talking about an Entry widget.......

#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 '-init';

Gtk2::Rc->parse_string(<<__);

#if you want to pull in a theme
#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 Insensitive" );
$button->signal_connect( clicked => sub { $entry->set_state('insensitive') } );

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;
__END__


zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]