Tkinter text box

  • Post category:Tkinter

In this Tkinter tutorial, you will learn how to add the Tkinter text box.

# import Tkinter Module
import tkinter as tk

# create main window
var = tk.Tk()

# Set title
var.title("My Tkinter")

# create a label
var2 = tk.Label(var, text="This is a given label")

# pack label
var2.grid(row=0, column=0)

# create a text box
var3 = tk.Text(var)

# pack text box
var3.grid(row=1, column=0)

# start the event loop
var.mainloop()

Output:

Free resources to learn advanced skills: AiHints and CodeAllow