Make Tkinter Entry widget readonly but selectable

若如初见. 提交于 2020-07-03 07:56:25

问题


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


回答1:


Use the state option "readonly":

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)



来源:https://stackoverflow.com/questions/3680301/make-tkinter-entry-widget-readonly-but-selectable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!