in reply to Tk Scrolled Text and Large Files
Short of that, there's no reason to create a duplicate of 50+M of data all at once. Treat it like a big input file and loop over the content as you move it to the output file:
Just like in normal file i/o, Tk::Text->get will return an empty string when the requested range falls entirely beyond the end of the current text content.open( OUT, ">some_file.txt" ) or die $!; my $startline = 1; my $linespan = 100; while (1) { my $startid = sprintf( "%.1f", $startline ); my $txt = $text_widget->get( $startid, "+ $linespan lines" ); last unless length( $txt ); print OUT $txt; $startline += $linespan; } close OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk Scrolled Text and Large Files
by Anonymous Monk on Oct 17, 2005 at 01:19 UTC | |
|
Re^2: Tk Scrolled Text and Large Files
by Anonymous Monk on Oct 17, 2005 at 01:36 UTC | |
by graff (Chancellor) on Oct 17, 2005 at 01:50 UTC |