Tkinter

How to Make Tkinter Text Widget Read Only

In this tutorial, we are going to see how to make Tkinter Text Widget read only in Python. The state of a Text widget is “NORMAL” by default, which means that the user can add or modify content. You must change the state of the “Text” widget to “DISABLED” to make it read-only.

text.configure(state='disabled')

 

 

How to Make Tkinter Text Widget Read Only
import tkinter as tk

root = tk.Tk()

texte = tk.Text(root)
texte.insert(1.0, "Welcome to StackHowTo!")
texte.configure(state='disabled')
texte.pack()

root.mainloop()

Output:


 
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *