简体   繁体   English

Python Tkinter GUI:用于具有可复制文本的窗口小部件

[英]Python tkinter GUI: which widget to use for having copyable text

I am new to designing GUIs in python and have a query: 我是刚开始使用python设计GUI并有一个查询:

Is there a way to have a label or any other widget with copyable text. 有没有一种方法可以使标签或带有可复制文本的任何其他窗口小部件。 I want to provide help section within GUI which will contain a sample xml to be given as input, I want user to be able to copy that xml. 我想在GUI中提供帮助部分,其中将包含示例xml作为输入,我希望用户能够复制该xml。

I don't want that information to go away if user cuts that information, so I am not using a entry widget with pre-filled data. 我不希望该信息在用户删除时消失,因此我不使用带有预填充数据的条目小部件。

Is there a way to achieve this? 有没有办法做到这一点?

Thanks! 谢谢!

Use a text widget in disabled state. 在禁用状态下使用text小部件。

There is no insertion cursor in this state, but the text may still be selected and copied (but not modified). 在这种状态下没有插入光标,但是仍可以选择和复制文本(但不能修改)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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