a simple color question
- From: zentara <zentara zentara net>
- To: gtk-perl-list gnome org
- Subject: a simple color question
- Date: Wed, 27 Apr 2005 15:53:03 -0400
Hi, I'm finding that setting up colors in Gtk2 is
not that simple, and the docs are sending me in
circles. :-)
For example in the following script,
how to I set the "active hightlight color" of the blue
button, i.e. when the mouse is over it?
A second question is how can I change the fill color
of the "control frame"? There is a hbox in the frame,
but changing the hbox color does nothing.
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Z');
$window ->signal_connect( 'destroy' => \&delete_event );
$window ->signal_connect( 'delete-event' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(300,200);
my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);
my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);
$hbox->set_border_width(2);
my $frame0 = Gtk2::Frame->new('Controls');
$vbox->pack_end( $frame0, FALSE, FALSE, 0 );
$frame0->set_border_width(3);
my $hbox0 = Gtk2::HBox->new( FALSE, 6 );
$frame0->add($hbox0);
$hbox0->set_border_width(3);
my $button = Gtk2::Button->new_from_stock('gtk-quit');
$hbox0->pack_end( $button, FALSE, FALSE, 0 );
$button->signal_connect( clicked => \&delete_event );
my $button1 = Gtk2::Button->new('Color-test');
$hbox0->pack_end( $button1, FALSE, FALSE, 0 );
$button1->signal_connect( clicked => sub{ print chr(07); });
my $red = Gtk2::Gdk::Color->new (0xFFFF,0,0);
my $green = Gtk2::Gdk::Color->new (0,0xFFFF,0);
my $blue = Gtk2::Gdk::Color->new (0,0,0xFFFF);
my $blue1 = Gtk2::Gdk::Color->new (0,0xCCCC,0xFFFF);
$window->modify_bg ('normal', $green);
$hbox0->modify_bg ('normal', $red);
$frame0->modify_bg ('normal', $red);
$button1->modify_bg ('normal', $blue1);
$button1->modify_bg ('selected', $blue);
$window->show_all();
Gtk2->main;
#####################################
sub delete_event {
Gtk2->main_quit;
return FALSE;
}
__END__
--
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]