"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/examples/after_demo" (15 Nov 2013, 501 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/local/bin/perl -w
    2 
    3 use Tk;
    4 use strict;
    5 require Tk::Label;
    6 
    7 my $fred = 'Something';
    8 
    9 sub toggle
   10 {
   11  use vars qw($callback);
   12  my $w = shift;
   13  my $r = $w->configure("-relief");
   14  $w->configure("-relief" => ($r eq "raised") ? "sunken" : "raised");
   15  $fred = reverse($fred);
   16  $callback = [\&toggle,$w] unless defined $callback;
   17  $w->after(1000,$callback);
   18 }
   19 
   20 
   21 my $top = MainWindow->new();
   22 
   23 
   24 my $l   = $top->Label('-textvariable'=> \$fred);
   25 
   26 $l->pack();
   27 
   28 &toggle($l);
   29 
   30 $top->update();
   31 
   32 Tk::MainLoop();
   33