Leser: 1
10 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/perl
use Tk;
$bool = 1;
my $window = MainWindow->new();
my $button = $window->Button(-text => 'Drück mich');
$button->bind("<ButtonPress-1>",sub{while($bool){print "Hello";}});
$button->pack();
MainLoop;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl
use Tk;
use strict;
use warnings;
my $mw = new MainWindow;
my $b = $mw->Button(-text => 'Run')->pack();
my $id;
my $i;
$b->bind('<ButtonPress-1>' => sub { $id = $mw->repeat(0, sub {print ++$i}) } );
$b->bind('<ButtonRelease-1>' => sub { $id->cancel() } );
MainLoop();
10 Einträge, 1 Seite |