开发者

Buffering/Updating issue for text element

I have this code:

#!/usr/bin/perl

use strict;
use Tkx;

my $mw = Tkx::widget->new('.');

$mw->g_wm_minsize( 开发者_运维问答400, 350 );

my $btn_start = $mw->new_ttk__button( -text => "Start", -width => 60, -command => sub { start(); } );

my $txt_processed_domains = $mw->new_tk__text( -width => 40, -height => 10, -state => "disabled", -wrap => "none" );

Tkx::grid( $btn_start, -row => 2, -columnspan => 3, -padx => 10, -pady => 10 );

Tkx::grid( $txt_processed_domains, -row => 3, -columnspan => 3, -padx => 10, -pady => 10 );

Tkx::MainLoop();

sub start {

    foreach my $id ( 1.. 10 ) {

        $txt_processed_domains->configure(-state => "normal");
        $txt_processed_domains->insert_end( "$id => Available\n" );
        $txt_processed_domains->configure(-state => "disabled");

        sleep 1;
    }

    Tkx::tk___messageBox( -message => "Completed!" );
}

I need to see which ids are processed but only get whole list at the end. It's like buffering with filehandles but i'm not sure. How to see text in the text box just after inserting it?


I find Tkx::update(); do what i want.


Tkx::update_idletasks() would be the preferred call in this case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜