Can't change button font size
- From: Mike Mayer <mikem circuitfarm com>
- To: gtk-perl-list gnome org
- Subject: Can't change button font size
- Date: Tue, 03 Feb 2004 15:43:33 -0600
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]