Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^3: Tk::Text insert buffer!

by zentara (Archbishop)
on Sep 26, 2012 at 15:23 UTC ( #995793=note: print w/replies, xml ) Need Help??

in reply to Re^2: Tk::Text insert buffer!
in thread Tk::Text insert buffer!

I need display info on text widget immediately after insert method,no buffer,not wait 3 seconds and then display whole info. Can I?

Hi, sure you can. Using your example without the sleep statement:

#!/usr/bin/perl -w use strict; use Tk; $| = 1; my $mw = MainWindow->new; my $text = $mw->Text->pack; my $bt = $mw->Button(-text => 'insert', -command => sub {&test_insert})->pack; MainLoop; sub test_insert{ for (1..3){ $text->insert('end', "$_\n"); } }
or you may not be showing the real code you need to use. If you are trying to display something from some other source, and the Text widget isn't displaying it right away, you can try putting a "$mw->update" or a "$text->update" right after your insert statement. This timer may be what you are looking for, otherwise explain in greater detail what you are actually trying to display.
#!/usr/bin/perl -w use strict; use Tk; $| = 1; my $mw = MainWindow->new; my $text = $mw->Text->pack; my $repeater = $mw->repeat(1000, \&test_insert); MainLoop; sub test_insert{ $text->insert('end', time."\n"); }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^4: Tk::Text insert buffer!
by Alle (Novice) on Sep 26, 2012 at 15:30 UTC

    Thank you very , the update method is my need,

    add code '$text->update' after '$text->insert(...)', It works perfect, thanks again!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995793]
[chacham]: there's a regexp function. if that can be used ina check() constraint...
[LanX]: Thanks, but no check constraints in MySQL :/
LanX 1 ..2 ..3 ..4 .. is erix missing ;-)
LanX is Discipulus reciting "Springtime for Hitler" ?
[choroba]: erix could tell you how to do it in Postgres
[chacham]: wow, mysql really is as bad as i thougt
[choroba]: completion?
[LanX]: That's what he usually does when MySQL is mentioned ;-)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2017-03-30 15:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (360 votes). Check out past polls.