使 Tkinter Entry 小部件只读但可选择 [英] Make Tkinter Entry widget readonly but selectable

查看:39
本文介绍了使 Tkinter Entry 小部件只读但可选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 Tkinter Entry 小部件可以突出显示和复制文本,但不能更改?

Is there any way to make the Tkinter Entry widget so that text can be highlighted and copied, but not changed?

推荐答案

使用 state选项 只读":

状态=入口状态:NORMAL、DISABLED 或只读"(与 DISABLED 相同,但内容仍然可以选择和复制).默认为正常.注意如果您将其设置为 DISABLED 或只读",调用插入和删除被忽略.(州/州)

state= The entry state: NORMAL, DISABLED, or "readonly" (same as DISABLED, but contents can still be selected and copied). Default is NORMAL. Note that if you set this to DISABLED or "readonly", calls to insert and delete are ignored. (state/State)

这篇关于使 Tkinter Entry 小部件只读但可选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆