Thread fragen zur Listbox in Tk (5 answers)
Opened by Mako at 2007-10-16 15:30

renee
 2007-10-18 16:33
#101026 #101026
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Meinst Du so etwas:
Code (perl): (dl )
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
#!/usr/bin/perl

use strict;
use warnings;
use Tk;
use Tk::Listbox;

my $mw = tkinit;

my %h = (
    0 =>  { 
        X1 => 'value1',
        Y1 => 'value2',
        X2 => 'value3',
        Y2 => 'value4',
    },
    1 => {
        X1 => 'value5',
        Y1 => 'value6',
        X2 => 'value7',
        Y2 => 'value8',
    },
);

my $i_liste = $mw->Listbox->pack(-side => 'left', -anchor => 'w');
my $k_liste = $mw->Listbox->pack(-side => 'left', -anchor => 'w');
my $v_liste = $mw->Listbox->pack(-side => 'left', -anchor => 'w');

for my $key ( sort keys %h ){
    for my $key2 ( sort keys %{ $h{$key} } ){
        $i_liste->insert('end',$key);
        $k_liste->insert('end',$key2);
        $v_liste->insert('end',$h{$key}->{$key2});
    }
}

MainLoop;
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread fragen zur Listbox in Tk