If you run this:

from tkinter import * root = Tk() 

then everything works. And if so:

 import tkinter root = Tk() 

then writes that the variable Tk is not defined. Why?

    1 answer 1

    This expression imports all modules from the tkinter library, so the Tk class appears in scope.

     from tkinter import * 

    And here you import only the module itself, and to access its contents, you must explicitly indicate where the content comes from.

     import tkinter root = tkinter.Tk()