in reply to how to change the font of a perl tk gui
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Font; sub change { my ($size_ref, $change, $l) = @_; $$size_ref += $change; $l->configure(-font => $l->fontCreate(-size => $$size_ref)); } my $mw = 'MainWindow'->new(-title => 'Scalable'); my $size = 12; my $font = $mw->fontCreate(-size => $size); my $l = $mw->Label(-text => 'Some text', -font => $font)->pack; my $f = $mw->Frame->pack; my $plus = $f->Button(-text => '+', -command => [\&change, \$size, 1 +, $l])->pack(-side => 'left'); my $minus = $f->Button(-text => '-', -command => [\&change, \$size, -1 +, $l])->pack(-side => 'right'); my $quit = $mw->Button(-text => 'Quit', -command => sub { exit })->pack; MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to change the font of a perl tk gui
by ghosh123 (Monk) on Aug 16, 2013 at 14:07 UTC | |
by stefbv (Priest) on Aug 16, 2013 at 14:30 UTC | |
by ghosh123 (Monk) on Aug 17, 2013 at 15:00 UTC | |
by stefbv (Priest) on Aug 17, 2013 at 16:01 UTC | |
by ghosh123 (Monk) on Aug 17, 2013 at 16:33 UTC |