RE: screen display only updates on callback to text widget
Michael van Nieuwenhuize <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <6.1.1.1.2.20050509101925.03149848@qcmail1> |
Bill, Glad to hear that did the trick. Actually it is documented in the pod for Tk::Widget. It seems this method is inherited by all tk widgets. There is also an idletasks method which does updating as well. I have had mixed success using idletasks, so I tend to use the update method. Maybe some on the list more advanced than me can point out when it is best to use one method over the other. You can see perldoc Tk::Widget for the information. Regards, Mike At 07:30 PM 5/6/2005, Bill Mezian wrote: >Mike, > >Thanks for the speedy response. You were right on the money. The update() >function seems to be what was missing from the docs (or my interpretation of >them). > >It was not necessary to update the main window, a call to $t->update() after >a $t->insert worked for the read only text widget in all instances, and for >the progress bar as follows: >$percent_done += 5; >$progress->update(); > >This would have to carry less overhead than updating the main window and all >embedded widgets. > >Thanks again, > >All the best, >Bill > >-----Original Message----- >From: Michael van Nieuwenhuize [mailto:[email protected]] >Sent: Friday, May 06, 2005 6:18 PM >To: [email protected]; [email protected] >Subject: Re: screen display only updates on callback to text widget > > >Bill, > >The is a update method for your mainwindow. > >$mainWindow->update(); > >When ever you call this method it will update the entire gui. I think each >widget might >also inherit this method. So you may want to try $t->update after each read >to see >if it works. If not you could update mainwindow in your read loop. Not sure >been a while since >I have done any work with text widgets. If I remember correctly update can >eat up resources >so you may have to do some experimentation to see what works best for you. > > >Regards, > >Mike > >At 03:01 PM 5/6/2005, Bill Mezian wrote: > >Hello all, > > > >On the Win32 platform using active State 5.8x, I have a program that while > >processing a file, writes updates to a text widget, with processing > >beginning by a command subroutine from a button press: > > > >$f ->Button(-text => "Process New", > > -font => 'tahoma 8 bold', > > -activebackground => '#D0C36B', > > -command => \&process_data_file) > > ->pack(-side => 'left', -expand => 1, -fill => 'x', -pady >=> > >1, -anchor => 'w'); > > > >The callback to the ROText widget is: > > > >$t->insert("end", "Adding ". $dlrstnum . " " . $year . " " . $make . " " . > >$model . "\n"); > > > >called from within a while loop. My problem is this, the screen display >only > >updates after all of the processing has finished, rather than writing each > >line out to the window as it is being processed. > > > >Can anyone help with a suggestion on how to get the screen display to >update > >as the file is processing? The behavior is also the same using a progress > >bar, and output from a ping command to the same text widget. > > > >Thanks for any help! > > > >Bill > > > >-++**==--++**==--++**==--++**==--++**==--++**==--++**== > >This message was posted through the Stanford campus mailing list > >server. If you wish to unsubscribe from this mailing list, send the > >message body of "unsubscribe ptk" to [email protected] -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]