Leser: 3
![]() |
|< 1 2 >| | ![]() |
11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use strict;
use Tk;
use Tk::Compound;
my $mw = MainWindow->new;
my $mylabel = $mw->Label()->pack;
my $i = $mylabel->Compound;
$i->Line;
$i->Text(-text => 'Line ');
$i->Bitmap(-bitmap => 'warning');
$mylabel->configure(-image => $i);
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
35
36
37
38
39
40
#! /usr/local/bin/perl -w
require 5.005;
use strict;
use English;
use Tk;
# Create main window with button and text widget in it...
my $top = MainWindow->new;
my $btn = $top->Button(-text=>'print odd lines')->pack;
my $txt = $top->Scrolled('Text', -relief=>'sunken', -borderwidth=>'2',
-setgrid=>'true', -height=>'30', -scrollbars=>'e');
$txt->pack(-expand=>'yes', -fill=>'both');
$btn->configure(-command=>sub{&GetText($txt)} );
# Populate text widget with lines tagged odd and even...
my $lno;
my $oddeven;
foreach $lno (1..20) {
if($lno % 2) { $oddeven = "odd" } else { $oddeven = "even" };
$lno = "Line $lno ($oddeven)\n";
$txt->insert ('end', $lno, $oddeven);
}
# Do the main processing loop...
MainLoop();
sub GetText {
my $txtobj = shift;
$txtobj->tag('configure', 'odd', -background=>'lightblue');
$txtobj->tag('configure', 'even', -background=>'lightgreen');
# This is the goal of all the work...
my @lines = $txtobj->get($txtobj->tagRanges('odd'));
print STDERR join("", @lines);
}
my $i = $mylabel->Compound(-background => 'red',);
1
2
3
4
5
my $spalteplus = $anzeige->Compound;
$spalteplus->Text ( -text => $feldnamen[$ypos]);
$spalteplus->Space( -width => 2);
$spalteplus->Image( -image => $MamaGUI->Photo(-file=>"$dir/icons/desc.gif"));
$anzeige->tagConfigure('logo', -image => $spalteplus, -showtext => 1);
1
2
3
4
5
6
7
8
use Tk;
$top=tkinit;
$p = $top->Compound(-background => "red", -showbackground => 1);
$p->Text(-text => "Hello");
$i = $top->Photo(-file => Tk->findINC("Xcamel.gif"));
$p->Image(-image => $i);
$top->Label(-image => $p, -border => 0)->pack;
MainLoop;
![]() |
|< 1 2 >| | ![]() |
11 Einträge, 2 Seiten |