Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
use Tk;
my $mw = MainWindow->new;
my $colorRed = 0;
my $colorGrn = 1;
my $colorBlu = 0;
my $colorYlw = 1;
my $menu = $mw->Menu (-type => 'menubar');
$mw->configure (-menu => $menu);
my $file = $menu->cascade (-label => '~Colors');
my $chk1 = $file->checkbutton (
-label => '~Red',
-variable => \$colorRed,
-onvalue => 1,
-offvalue => 0,
);
my $chk2 = $file->checkbutton (
-label => '~Green',
-variable => \$colorGrn,
-onvalue => 1,
-offvalue => 0,
);
my $chk3 = $file->checkbutton (
-label => '~Blue',
-variable => \$colorBlu,
-onvalue => 1,
-offvalue => 0,
);
my $chk4 = $file->checkbutton (
-label => '~Yellow',
-variable => \$colorYlw,
-onvalue => 1,
-offvalue => 0,
);
$file->separator;
my $exit = $file->command (
-label => 'E~xit',
-command => sub { exit; },
);
MainLoop;
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
use Tk;
my $mw = tkinit;
my $cb = $mw -> Checkbutton(-text => 'Word Wrap') -> pack;
$cb -> select;
MainLoop;
use Tk;
my $mw = tkinit;
my $mbar = $mw -> Menu();
$mw -> configure(-menu => $mbar);
my $format = $mbar -> cascade(-label=>"Format", -underline=>0, -tearoff => 0);
my $cb = $format -> checkbutton(-text => 'Word Wrap');
$cb -> select;
MainLoop;
$var = 1;
$cb = $mw->checkbutton (-variable => \$var, -onvalue => 1, -offvalue => 0);
# uncheck the box
$var = 0;
# check it again
$var = 1;
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
checkbutton (
-onvalue => "yes",
-offvalue => "no",
);
# if the var == yes, box is checked, otherwise unchecked
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
our $wrap = 0;
...
our $format = $menu -> cascade(
-label => 'Format',
-tearoff => 0,
-underline => 0,
-menuitems => [
[checkbutton => 'Word Wrap', -command => \&format_wrap,
-variable => \$wrap],
[command => 'Font', -command => \&format_font],
]
);
...
sub format_wrap {
$txt -> configure(-wrap => $wrap ? 'word' : 'none');
}