How to Solve NameError: name 'Tk' is not defined -- tkinter

Solution: Import the 'Tk' module

To Solve the error, add the following line to the top of your code.

from tkinter import Tk

 

For more information:
Python tkinter Tk