+ -
当前位置:首页 → 问答吧 → TK中一个比较有难度的问题,看有没有人能够了解决。

TK中一个比较有难度的问题,看有没有人能够了解决。

时间:2011-04-06

来源:互联网

  1. use Tk;
  2. use Tk::HList;

  3. sub icmd {
  4.   my ($path, $state) = @_;
  5.   print "path is '$path', state is '$state'\n";
  6. }

  7. my $mw = MainWindow->new;


  8. my $hlist = $mw->HList(-columns => 4, -header => 1)
  9.    ->pack(-expand => 1, -fill => 'both');

  10. $hlist->headerCreate(0, -text => "Color Name");
  11. $hlist->headerCreate(1, -text => "Red value");
  12. $hlist->headerCreate(2, -text => "Green value");
  13. $hlist->headerCreate(3, -text => "Blue value");

  14. foreach (qw/orange red green blue purple/) {
  15.   my ($r, $g, $b) = $mw->rgb($_);
  16.   $hlist->add($_);
  17.   $hlist->itemCreate($_, 0, -text => $_,);
  18.   $hlist->itemCreate($_, 1, -text => , $r);
  19.   $hlist->itemCreate($_, 2, -text => , $g);
  20.   $hlist->itemCreate($_, 3, -itemtype => 'image',-image => $mw->Getimage('file'));

  21. }


  22. MainLoop;
复制代码
如何设定这一行颜色,点击这一行后,file自动变成puls, 有没有大仙懂的??$hlist->itemCreate($_, 3, -itemtype => 'image',-image => $mw->Getimage('file'));

作者: ymhui520   发布时间: 2011-04-06

不看文档当然觉得有难度了。

作者: flw   发布时间: 2011-04-06

版主,能指点下么..

作者: ymhui520   发布时间: 2011-04-06