File: canvas_scroll

package info (click to toggle)
perl-tk 1%3A800.015-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,636 kB
  • ctags: 18,270
  • sloc: ansic: 195,135; perl: 37,385; makefile: 4,380; sh: 2,286; yacc: 762
file content (36 lines) | stat: -rwxr-xr-x 791 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
32
33
34
35
36
#!/usr/local/bin/perl -w

use Tk;

$top = MainWindow->new();

$top->wm("minsize",  10, 10);
$top->wm("geometry", "100x100");

$c = $top->Canvas("-width" => 200,"-height" => 200);


$s1 = $top->Scrollbar("-command" => ["yview",$c]);
$s2 = $top->Scrollbar("-orient" => "horizontal",
                           "-command" => ["xview",$c]);
$c->configure("-yscrollcommand" => ["set",$s1]);
$c->configure("-xscrollcommand" => ["set",$s2]);


$id = $c->create("line",0,0, 0,200, 200,0, 200,200, 0,0, 200,0, 200,200, 0,200,
                 "-width" => 4);

print "id=$id\n";

$c->configure("-scrollregion" => [0,0,204,204]);


$s1->pack( "-side"   => "left", "-fill"   => "y");
$s2->pack(  "-side"   => "bottom", "-fill"   => "x");
$c->pack("-expand" => 1, "-fill" => "both" );


Tk::MainLoop;