Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我编写了一个获取文件名并将文件内容插入到Text 小部件的脚本。现在,当我关闭脚本窗口时,我需要它将文本写入 Unix 屏幕。
如何获取文本小部件内容?
我的文本小部件插入源代码是:
open(FILE, $file_name); foreach my $line (<FILE>) { $text->insert('end', $line); }
$text->get('1.0','end-1c');
(这是end-1c- 少一个字符的结尾 - 出于相当技术性的原因;只需end附加一个额外的换行符。一个已知的 Tk 陷阱。)
end-1c
end