#!/usr/bin/perl # # Create a button with colorized text # use strict; use warnings; use Glib qw(TRUE FALSE); use Gtk2 '-init'; use Data::Dumper; exit main(); sub main { my $window = Gtk2::Window->new(); my $vbox = Gtk2::VBox->new(FALSE, 10); my $button_plain = Gtk2::Button->new_with_label("Plain"); # Create a color with an empty label and replace the label's text with our own # pretty colored text. my $button_color = Gtk2::Button->new_with_label(''); $button_color->get_child->set_markup( "Color button" ); $vbox->pack_start($button_plain, FALSE, FALSE, 10); $vbox->pack_start($button_color, FALSE, FALSE, 10); $window->add($vbox); $window->signal_connect(destroy => sub { Gtk2->main_quit(); }); $window->show_all(); Gtk2->main(); return 0; }