Tkinter 10: Text widget

The text widget

With this tool you can add more text than in the usual entry widget. So, let’s see how does it works.

Example of use of the text widget in tkinter

"""text widget of tkinter

Creates a window with a text box
when you hit ctrl + s it will print the
content of the text box in the console
"""

from tkinter import Tk
import tkinter as tk


root = Tk()


def start(event):
    print(text.get("0.0", tk.END))


text = tk.Text(root)
text.pack()
text.bind("<Control - s>", start)
root.mainloop()

Video about tkinter’s widget text

Tkinter test for students

Tkinter articles

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.