Hi all,

Hi all, when click on an item which laied in a ListBox, can we let some strings 
print 

into a Text widget area.

Below is my perl script which does not work properly.

use warnings;
use strict;
use Tk;
use URI;

my $mw = MainWindow->new;

my $text = $mw->Scrolled(qw/Text -relief sunken -borderwidth 2 -setgrid 1
               -height 10 -width 20 -scrollbars se/);
$text->pack(qw/-expand yes -fill both/);

my $list = $mw->Scrolled(qw/Listbox -setgrid 1 -height 10 -width 20 -scrollbars 
se/);
$list->pack(qw/-side bottom -expand yes -fill both/);
$list->focus;
$list->bind('<Double-1>' => 
        sub {
            print "want to print an url's content to '\$text'\n";
        },
);

my(@pl) = qw/-side top -pady 1 -anchor nw/;
open IN, "<urls" or die $!;
while(<IN>){
    chomp;
    next if $_ =~ /^\s*$/;
    my $url = URI->new($_);
    my $b1 = $list->Checkbutton(
        -text     => "$url",
      -relief   => 'flat'
    )->pack(@pl);    
}
close IN;
MainLoop;

Who can help me? thanks.

Hui Wang





                
---------------------------------
 Mp3疯狂搜-新歌热歌高速下   

Reply via email to