2. Importing tkinter
2.1. tkinter recommended import
import tkinter as tk
You need to prefix the objects with tk. to access them (e.g., tk.Button, tk.Label).
This makes it explicit about where tk objects come from.
It provides better clarity and avoids potential naming conflicts.
It's good practice.
2.2. tkinter import everything
from tkinter import *
This removes the need to prefix the objects with
tkinter.to access them (e.g.,Buttoninstead oftkinter.Button).It makes it hard to tell what methods are from tkinter.
This is poor practice.
2.3. tkinter import
import tkinter
The
tkinter.prefix is needed for tkinter objects.It makes slightly longer code by using
tkinter.Buttoncompared totk.Button