Leser: 1
9 Einträge, 1 Seite |
$mw->Text->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => 'both');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use Tk;
$mw = MainWindow->new();
$frame = $mw->Frame();
$scrollx = $frame->Scrollbar(-orient => 'horizontal');
$scrolly = $frame->Scrollbar();
$text = $frame->Text(-xscrollcommand => ['set' => $scrollx], -yscrollcommand => ['set' => $scrolly]);
$scrollx->configure(-command => ['xview' => $text]);
$scrolly->configure(-command => ['yview' => $text]);
$scrollx->pack(-side => 'bottom', -fill => 'x');
$scrolly->pack(-side => 'right', -fill => 'y');
$text->pack(-side => 'top', -expand => 1, -fill => 'both');
MainLoop;
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
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::ROText;
tk_start();
exit;
sub tk_start {
my $mw = new MainWindow;
my $t = $mw->Scrolled(
'ROText',
-scrollbars => 'osoe',
-height => 10,
-width => 50,
-wrap => 'none',
)->pack(
-fill => 'both',
-expand => 1,
);
seek DATA, 0, 0;
while (<DATA>) {
$t->insert('end', $_);
}
MainLoop();
} # sub tk_start
_ _DATA_ _
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::ROText;
tk_start();
exit;
sub tk_start {
my $mw = new MainWindow;
#
# horizontale und vertikale Rollbalken:
#
my $rollx = $mw->Scrollbar(
-orient => 'horizontal',
)->pack(
-side => 'bottom',
-fill => 'x',
);
my $rolly = $mw->Scrollbar(
)->pack(
-side => 'right',
-fill => 'y',
);
#
# Textwidget:
#
my $text = $mw->ROText(
-height => 10,
-width => 50,
-wrap => 'none',
-xscrollcommand => ['set' => $rollx],
-yscrollcommand => ['set' => $rolly],
)->pack(
-fill => 'both',
-expand => 1,
);
#
# Die Rollbalken an das Textwidget binden:
#
$rollx->configure(-command => ['xview' => $text]);
$rolly->configure(-command => ['yview' => $text]);
#
# Textwidget füllen
#
seek DATA, 0, 0;
while (<DATA>) {
$text->insert('end', $_);
}
MainLoop();
} # sub tk_start
_ _DATA_ _
1
2
3
4
5
6
7
for my $id ($canvas->find("all")) {
push @canvas, { type => $canvas->type($id),
coords => [ $canvas->coords($id) ],
config => [ map { ($_->[0], $canvas->itemcget($id, $_->[0])) } $canvas->itemconfigure($id) ],
# evtl. weitere interessante Optionen
};
}
Quoteund falls jpeg oder aehnliches gewuenscht ist, die aktionen auf GD oder Image::Magick uebertragen und ausfuehren...
9 Einträge, 1 Seite |