Leser: 3
![]() |
![]() |
5 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -w
use strict;
use Tk;
my $main = new MainWindow;
my $canvar = $main ->Canvas;
$canvar->pack;
my $file = 'image.gif';
my $img =
$canvar->Photo( 'imggif',
-file => $file );
$canvar->create( 'image',0,0,
'-anchor' => 'nw',
'-image' => $img,
);
MainLoop;
1
2
3
4
my $item = $canvas ->create('polygon',5,100,50,5,
150,5,200,100,5,100,
-stipple='transparent');
$canvas->bind($item,'<Event>',Callback);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use warnings;
use strict;
use Tk;
use Tk::Balloon;
my $mw = tkinit;
my $can = $mw->Canvas->pack;
$can->createRectangle(10,10,100,100,-fill=>'red');
my $left = $can->createRectangle(10,10,50,100,
-stipple => 'transparent',
-fill => 'black',
-outline => '',
-tags => ['left'],
);
$can->bind($left,'<1>',sub{
$mw->messageBox(-message => 'you clicked the left side!');
});
my $b = $mw->Balloon();
$b->attach($can,
-balloonposition => 'mouse',
-msg => {'left' => 'click here for a message',
},
);
MainLoop;
![]() |
![]() |
5 Einträge, 1 Seite |