A text widget is created by using the Text() method.
import tkinter as tk
root = tk.Tk()
T = tk.Text(root, height=2, width=30)
T.pack()
T.insert(tk.END, "Just a text Widget\nin two lines\n")
w = tk.Label(root, text="Hello Tkinter!")
w.pack()
root.mainloop()
I am new to Python. My understanding is that Text and Label are classes and T and w are the objects created from Text and Label classes. But in the above text example, a website mentioned that
A text widget is created by using the
Text()method.
I am totally confused now. pack() is a method and we can apply methods on the objects (T and w here) that we created from classes like Label and Text.
Please let me know if the widgets like Label, Text, Button, etc. are classes or methods.