rehmanz has asked for the wisdom of the Perl Monks concerning the following question:

I am running perl tk on RHE 5. Eventhough I specify a bigger font size it does not change at all. Is there anything peculiar about RHE or my code snippet? Please help! Thanks in advance....
my $desc = $mw->Label ( -text => "SmartCheckin", -font => [-family => 'Courier', -size => 128, -weight => +'bold'], -width => 14, -anchor => 'w', -relief => 'groove', -background => 'grey', )->pack

Replies are listed 'Best First'.
Re: Perl Tk Font Issue on RHE 5
by zentara (Cardinal) on Aug 20, 2010 at 21:43 UTC
    I found that font specifications are tricky to get working, unless you use the following methods.
    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size=>int(-18*18/14)); $mw->fontCreate('medium', -family=>'courier', -weight=>'bold', -size=>int(-14*14/10)); my $entry = $mw->Entry(-font =>'big',-text=>'Big')->pack(); my $entry1 = $mw->Entry(-font =>'medium',-text=>'medium')->pack(); MainLoop;

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
Re: Perl Tk Font Issue on RHE 5
by Khen1950fx (Canon) on Aug 20, 2010 at 22:18 UTC
    I couldn't replicate the problem. I'm on FC6. Try this.
    #!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new; my $desc = $mw->Label( -text => "SmartCheckin", -font => [ -family => 'Courier', -size => 150, -weight => 'b +old' ], -width => 14, -anchor => 'w', -relief => 'groove', -background => 'grey', )->pack; my $entry = $mw->Entry->pack; my $button = $mw->Button( -text => "SmartCheckin", -command => \&push_button ); $button->pack; MainLoop; sub Entry { $entry->insert("SmartCheckin"); } sub push_button { $entry->insert( 0, "Does this help? " ); }
Re: Perl Tk Font Issue on RHE 5
by Tux (Canon) on Aug 21, 2010 at 16:00 UTC

    Modern perl-Tk accepts a much easier form for font specification. I don't know if it needs libXft compiled in, but I now always use:

    my $face = "DejaVu Sans Mono"; # Spaces and other non-ASCII chars are +allowed my $desc = $mw->Label ( -text => "SmartCheckin", -font => "{$face} 128 bold", -width => 14, -anchor => "w", -relief => "groove", -background => "grey", )->pack;

    Enjoy, Have FUN! H.Merijn