can you add after your 'insert'

$text1->update() to make a refresh.

You need an update if there is no new event in your widget.

Be areful : Don't use update for each line if you insert a lot of lines but only at the end of a batch or only every 100 lines to keep good performance.






macuser9214 a écrit :
I am trying to make a tk app that parses the qrz callsign ham radio database: It's not working. I'm trying to get information from the text field, and the result in the gray box.

#!/usr/bin/perl

use Tk;
use LWP::Simple;
use LWP::UserAgent;





    my $main = MainWindow -> new();
     $entry = $main -> Entry();
    $entry -> pack;
    $main->Button(-text => 'Look Up',
                  -command => sub{display($entry)}
                  )->pack;



my $text1 = $main->Text ('-width' => 30, '-height' => 15,
      '-background' => 'Grey',)-> pack;

$main->Button(-text => 'Stop', -command => [$main =>
'destroy'])->pack;


sub display {

     $call = $entry;
 $ua = LWP::UserAgent->new();
 $request = HTTP::Request->new('GET', "http://www.qrz.com/detail/$call";);
 $response = $ua->request($request);
$qrz = $response->content;

$qrz =~ m#Name</td><td class="q2"><b>(.*?)</b>#i; my $name = $1;
$qrz =~ m#Addr1</td><td class="q2"><b>(.*?)</b>#i; my $addr1 = $1;
$qrz =~ m#Addr2</td><td class="q2"><b>(.*?)</b>#i; my $addr2 = $1;
$qrz =~ m#Country</td><td class="q2"><b>(.*?)</b>#i; my $country = $1;
$qrz =~ m#Class:<b>(.*?)</b>#i; my $class = $1;
$class =~ s/\&nbsp;//g;
$class =~ s/^\s+//g;
$class =~ s/\s+$//g;


     $text1->insert('end', "$entry\n");


}





MainLoop;



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to