The New PerlTk.org - Save the contents of a Text widget
www.mamboteam.com
The New PerlTk.org  
Home
Friday, 18 April 2014
 
 
Main Menu
Home
Perl/Tk Widgets
Articles
Scripts
Useful Tips
Links
Contact Us
Search
FAQs
Login Form
Username

Password

Remember me
Forgotten your password?
No account yet? Create one
Save the contents of a Text widget PDF Print E-mail
Contributed by Christiaan ter Veen   
To do this you can simple use $text->get('0.0', 'end') and save the result to a file but end refers to the newline after the last character so if you open the file in your Text widget and save it again it will add a newline at the end of the file everytime.

instead use $text->get('0.0', 'end - 1 chars') so the newline is removed.

In some versions of Tk::TextUndo the save method also adds the newline, you can adapt the code at line 718.
Write Comment (1 Comments)
< Prev   Next >
 
Top! Top!