Thread [Tk] Itemstyle editieren (1 answers)
Opened by Kean at 2013-07-25 12:23

styx-cc
 2013-07-25 22:41
#169140 #169140
User since
2006-05-20
533 Artikel
BenutzerIn

user image
Ich rate einfach mal, wenn es nicht hinhaut, waere ein wenig Code deinerseits nicht verkehrt.
Code (perl): (dl )
1
2
my $red_style  = $hlist -> ItemStyle('text', -background => "red");
$red_style->configure(-background => 'yellow');


MfG

Edit: Bzw.:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
my @values = qw /test testtest2 test3 testtest4 test5 testtest6 test7 testtest8/;

my $blue_style = $hlist -> ItemStyle('text', -background => "lightblue");
my $red_style  = $hlist -> ItemStyle('text', -background => "red");

#$red_style->configure(-background => 'yellow');

$hlist -> itemCreate($i, 0, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style);

my $j = 0;

for (my $i=0; $i <= ($#values/2); $i++) {

  $hlist -> add($i);
  $hlist -> itemCreate($i, 0, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style); 
  $j++;

  $hlist -> itemCreate($i, 1, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style); 
  $j++;
}

Last edited: 2013-07-25 22:44:27 +0200 (CEST)
Pörl.

View full thread [Tk] Itemstyle editieren