简体   繁体   中英

How can I get the text in the Perl/Tk Text widget?

I have written a script that gets a file name and insert the file content to a Text widget . Now when I close the script window, I need it to write the text onto the Unix screen.

How can I get the Text widget content?

My text widget insertion sorce code is:

open(FILE, $file_name);
foreach my $line (<FILE>) {
    $text->insert('end', $line);
}
$text->get('1.0','end-1c');

(由于技术上的原因,这是end-1c末尾-少一个字符;仅在end附加了新行。已知的Tk陷阱。)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM