Can't change button font size



I can change label font sizes but not button font sizes, and I don't
know why. For example, the code below works for the label but not the
button:

#!/usr/bin/perl -w

use Gtk2 '-init';

use constant TRUE  => 1;
use constant FALSE => 0;

$scale = 5;

$win = Gtk2::Window->new;
$win->signal_connect("destroy" => sub { Gtk2->main_quit; });
$VBox = Gtk2::VBox->new(FALSE, 0);

$button = Gtk2::Button->new("Hello");

$context = $button->get_pango_context();
$fontDesc = $context->get_font_description();
$size = $fontDesc->get_size();
$newSize = int($size * $scale);
$fontDesc->set_size($newSize);

$button->modify_font($fontDesc);

$VBox->pack_start($button, FALSE, FALSE, 2);

$label = Gtk2::Label->new("Hello");
$context = $label->get_pango_context();
$fontDesc = $context->get_font_description();
$size = $fontDesc->get_size();
$newSize = int($size * $scale);
$fontDesc->set_size($newSize);

$label->modify_font($fontDesc);

$VBox->pack_start($label, FALSE, FALSE, 2);

$win->add($VBox);
$win->show_all();
Gtk2->main;


-- 
=============================================================================
Mike Mayer                                      Phone: (608) 523-1960
Circuitfarm, Inc.                               Cell:  (608) 575-2732
mikem circuitfarm com





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