Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tk::Text - refresh without blinking

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
HI,

Is there any better way to refresh text without deleting it every time in loop,thus aviding the whole display blinking ?
thanks
============================
while (1) {
$txt ->insert('end',"$message","$color1");
$txt->see ('end');
$mw->update ;
sleep 2 ;

#clear all data
$txt->delete('0.0','end');
$mw->update ;
}

Long live king Moshiach !
 
Every 2 seconds, could you not just compare the existing text with the updated version? Then you could make the refresh conditional, so it only happens if ($old != $new)? So it would only refresh when something had actually changed, which should stop the flashing.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Thanks,

I actualuy display NIC net boards counters,so the data DOES change every 2 seconds...
However,I would like only the numbers to change,but not all the headers around,so that it would not blink that much to user.


Long live king Moshiach !
 
This should be easy: update less!

Code:
while (1) {
    $txt ->insert('end',"$message","$color1");
    $txt->see ('end');     
    $mw->update ;
     sleep 2 ;

     #clear all data
     $txt->delete('0.0','end');
     ###$mw->update ;
}

If you change a widget, the change is never visible until you call update() (or MainLoop handles this for you if you're not using a while(1) loop like you are). So if you clear the widget and then repopulate it, and THEN update, then the empty widget should never have been visible on the screen and it won't "blink".

If that doesn't work (I'm pretty sure it will though) and the text is predictably formatted, you can insert() and delete() at specific coordinates, too.

-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top