It's simple.

For python2 it is:

from Tkinter import *

For python3 it is:

from tkinter import *

Here's the way how can you forget about this confusion once and for all:

try:
    from Tkinter import *
except ImportError:
    from tkinter import *
Answer from alecxe on Stack Overflow
🌐
Python documentation
docs.python.org › 3 › library › tkinter.html
tkinter — Python interface to Tcl/Tk
February 23, 2026 - The only kinds of variables for which this works are variables that are subclassed from a class called Variable, defined in tkinter. There are many useful subclasses of Variable already defined: StringVar, IntVar, DoubleVar, and BooleanVar. To read the current value of such a variable, call the get() method on it, and to change its value you call the set() method. If you follow this protocol, the widget will always track the value of the variable, with no further intervention on your part. ... import tkinter as tk class App(tk.Frame): def __init__(self, master): super().__init__(master) self.pack() self.entrythingy = tk.Entry() self.entrythingy.pack() # Create the application variable.
Discussions

python - Import _tkinter or tkinter? - Stack Overflow
All tutorials simply import tkinter, I am wondering, though, why not import _tkinter? If my understanding is correct, _tkinter is the actual library in cpython and tkinter is the interface or API.... More on stackoverflow.com
🌐 stackoverflow.com
difference between from Tkinter import */import Tkinter as tk?
There are two ways of importing a module, by using the import and the from…import statements. The difference between the statements comes down to namespaces [1] . Namespaces are mappings from names (labels given to variables, functions, etc.) to the actual objects. Every module, class, function, etcetera, have their own namespaces where names associated with them (such as variables) live. For example: >>> x = 1 >>> def test(): x = 99 print(x) >>> test() 99 >>> x 1 Here, the x = 1 exists in the global namespace while x = 99, exists in the function's namespace. Due to this compartmentalisation, there is no danger of overwriting the first x with 99. Namespaces usually do not overlap with each other and so every variable has a scope or a level of visibility to other objects (as defined by the LEGB rule [2] ). Using the import statement: When using the import statement, you import the module as an object with its own separate namespace. You will have to access names (like functions and classes) within the module as a module.attribute operation. For example: >>> import math >>> math.sqrt(4) 2.0 Using the from…import statement: When you use the from…import statement, the module attribute is imported into the current namespace. This has the side effect of overwriting anything having the same name in the current namespace. For example: >>> digits = 123 >>> from string import digits >>> digits '0123456789' #'digits' has been overwritten The as extension: There is a way to overcome the aforementioned problem and that is to use the as extension. The as extension allows you to rename the imported attribute so as to not overwrite any names in the current namespace. For example: >>> digits = 123 >>> from string import digits as dg >>> digits 123 >>> dg '0123456789' #'dg' and 'digits' are separate names The as extension also works with the import statement to rename the imported module (if the module name is really long and gets tedious to type repeatedly): >>> import collections as col >>> col.OrderedDict(a=1, b=2, c=3) OrderedDict([('a', 1), ('b', 2), ('c', 3)]) The from…import * statement: The from…import * is the worst of the kind though. The wildcard operator * imports all attributes from the module namespace into the current namespace. This can lead to namespace corruption on a large scale with everything being overwritten. The use of this is usually not recommended. For example: >>> degrees = ['PhD', 'Masters', 'Bachelors'] >>> e = 'Hello!' >>> from math import * >>> degrees >>> e 2.718281828459045 The safest route is using the import statement. This is because using this statement keeps the namespaces separate (hence names from colliding) and also gives it explicitness (from the Zen of Python: explicit is better than implicit, which can be viewed by using import this) as to which module the name originates from due to the module.attribute usage. The from...import has the advantage of lesser typing (you don't have to access module functions with module.attribute) but at the cost of a possibility in namespace corruption (which can be remedied with the as extension). As for from...import *, avoid it unless absolutely required (even then, you should probably sleep over the decision). There's not much difference in performance as both import and from...import imports the module as a whole to convert it into bytecode. The from...import has the additional task of merging the module attributes to the current namespace. Hope this clears things up. Happy learning! More on reddit.com
🌐 r/learnprogramming
4
4
June 23, 2015
A little import confusion with tkinter
So I am a little confused on the importing of modules in python, specifically in regards to tkinter. In this small code snippet for a hello world app from tkinter import * from tkinter import ttk root = Tk() frm = t… More on discuss.python.org
🌐 discuss.python.org
3
0
July 22, 2022
Difference between tk.Tk() and Tk()?
Both are referring to the same Tk class, however they differ in how Tkinter was imported: import tkinter as tk root = tk.Tk() # or from tkinter import * root = Tk() Note that the first style is preferred . More on reddit.com
🌐 r/Tkinter
3
4
February 28, 2021
Top answer
1 of 4
33

from Tkinter import * imports every exposed object in Tkinter into your current namespace. import Tkinter imports the "namespace" Tkinter in your namespace and import Tkinter as tk does the same, but "renames" it locally to 'tk' to save you typing

let's say we have a module foo, containing the classes A, B, and C.

Then import foo gives you access to foo.A, foo.B, and foo.C.

When you do import foo as x you have access to those too, but under the names x.A, x.B, and x.C. from foo import * will import A, B, and C directly in your current namespace, so you can access them with A, B, and C.

There is also from foo import A, C wich will import A and C, but not B into your current namespace.

You can also do from foo import B as Bar, which will make B available under the name Bar (in your current namespace).

So generally: when you want only one object of a module, you do from module import object or from module import object as whatiwantittocall.

When you want some modules functionality, you do import module, or import module as shortname to save you typing.

from module import * is discouraged, as you may accidentally shadow ("override") names, and may lose track which objects belong to wich module.

2 of 4
4

You can certainly use

import Tkinter

However, if you do that, you'd have to prefix every single Tk class name you use with Tkinter..

This is rather inconvenient.

On the other hand, the following:

import Tkinter as tk

sidesteps the problem by only requiring you to type tk. instead of Tkinter..

As to:

from Tkinter import *

it is generally a bad idea, for reasons discussed in Should wildcard import be avoided?

🌐
TutorialsPoint
tutorialspoint.com › difference-between-import-tkinter-as-tk-and-from-tkinter-import
Difference between import tkinter as tk and from tkinter import
The major difference between both the ways is, if we want to define the widget constructor explicitly by defining which module it is associated with, then we can use the acronym method. However, if we want to define every widget by importing all the functions and modules in it, then we can ...
🌐
Sololearn
sololearn.com › en › Discuss › 2046412 › from-tkinter-import-vs-import-tkinter
(from tkinter import *) vs (import tkinter)
October 23, 2019 - Sololearn is the world's largest community of people learning to code. With over 25 programming courses, choose from thousands of topics to learn how to code, brush up your programming knowledge, upskill your technical ability, or stay informed about the latest trends.
🌐
TutorialsPoint
tutorialspoint.com › difference-between-tkinter-and-tkinter
Difference between tkinter and Tkinter
The only difference between Tkinter and tkinter is that Tkinter was initially used with Python 2 and tkinter is used for working with Python 3 or later versions. Try to run this simple code in Python 3 or higher, it will display an error message. #Import the tkinter library from Tkinter import ...
🌐
Wikipedia
en.wikipedia.org › wiki › Tkinter
Tkinter - Wikipedia
4 days ago - For Python 2, the only difference is the word "tkinter" in the import command will be capitalized to "Tkinter".
Find elsewhere
🌐
Reddit
reddit.com › r/learnprogramming › difference between from tkinter import */import tkinter as tk?
r/learnprogramming on Reddit: difference between from Tkinter import */import Tkinter as tk?
June 23, 2015 -

What is the difference between those two and what other ways are there to import Tkinter? And why are there many ways of importing?

Top answer
1 of 3
6
There are two ways of importing a module, by using the import and the from…import statements. The difference between the statements comes down to namespaces [1] . Namespaces are mappings from names (labels given to variables, functions, etc.) to the actual objects. Every module, class, function, etcetera, have their own namespaces where names associated with them (such as variables) live. For example: >>> x = 1 >>> def test(): x = 99 print(x) >>> test() 99 >>> x 1 Here, the x = 1 exists in the global namespace while x = 99, exists in the function's namespace. Due to this compartmentalisation, there is no danger of overwriting the first x with 99. Namespaces usually do not overlap with each other and so every variable has a scope or a level of visibility to other objects (as defined by the LEGB rule [2] ). Using the import statement: When using the import statement, you import the module as an object with its own separate namespace. You will have to access names (like functions and classes) within the module as a module.attribute operation. For example: >>> import math >>> math.sqrt(4) 2.0 Using the from…import statement: When you use the from…import statement, the module attribute is imported into the current namespace. This has the side effect of overwriting anything having the same name in the current namespace. For example: >>> digits = 123 >>> from string import digits >>> digits '0123456789' #'digits' has been overwritten The as extension: There is a way to overcome the aforementioned problem and that is to use the as extension. The as extension allows you to rename the imported attribute so as to not overwrite any names in the current namespace. For example: >>> digits = 123 >>> from string import digits as dg >>> digits 123 >>> dg '0123456789' #'dg' and 'digits' are separate names The as extension also works with the import statement to rename the imported module (if the module name is really long and gets tedious to type repeatedly): >>> import collections as col >>> col.OrderedDict(a=1, b=2, c=3) OrderedDict([('a', 1), ('b', 2), ('c', 3)]) The from…import * statement: The from…import * is the worst of the kind though. The wildcard operator * imports all attributes from the module namespace into the current namespace. This can lead to namespace corruption on a large scale with everything being overwritten. The use of this is usually not recommended. For example: >>> degrees = ['PhD', 'Masters', 'Bachelors'] >>> e = 'Hello!' >>> from math import * >>> degrees >>> e 2.718281828459045 The safest route is using the import statement. This is because using this statement keeps the namespaces separate (hence names from colliding) and also gives it explicitness (from the Zen of Python: explicit is better than implicit, which can be viewed by using import this) as to which module the name originates from due to the module.attribute usage. The from...import has the advantage of lesser typing (you don't have to access module functions with module.attribute) but at the cost of a possibility in namespace corruption (which can be remedied with the as extension). As for from...import *, avoid it unless absolutely required (even then, you should probably sleep over the decision). There's not much difference in performance as both import and from...import imports the module as a whole to convert it into bytecode. The from...import has the additional task of merging the module attributes to the current namespace. Hope this clears things up. Happy learning!
2 of 3
2
Well when you import a module as something you basically rename it. Import Tkinter as poop would work too. I'm not super technical but when you import * from something you import all classes methods variables into your current code. TK.derp() would become derp() if you used " from TKinter import *" as opposed to " import TKinter as TK". Also try out wxpyton, it's by far my favorite for gui building.
🌐
Python.org
discuss.python.org › python help
A little import confusion with tkinter - Python Help - Discussions on Python.org
July 22, 2022 - So I am a little confused on the importing of modules in python, specifically in regards to tkinter. In this small code snippet for a hello world app from tkinter import * from tkinter import ttk root = Tk() frm = ttk.Frame(root, padding=10) frm.grid() ttk.Label(frm, text=“Hello World!”).grid(column=0, row=0) ttk.Button(frm, text=“Quit”, command=root.destroy).grid(column=1, row=0) root.mainloop() I do not understand why you need both import statements, wouldn’t ‘from tkinter import *’ ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › difference-between-the-widgets-of-tkinter-and-tkinter-ttk-in-python
Difference Between The Widgets Of Tkinter And Tkinter.Ttk In Python - GeeksforGeeks
July 23, 2025 - Cross-Platform Appearance: While Tkinter provides a consistent but basic appearance across platforms, ttk widgets adapt to the native look and feel of the operating system, making applications appear more integrated and professional.
🌐
TutorialsPoint
tutorialspoint.com › why-do-we-use-import-and-then-ttk-in-tkinter
Why do we use import * and then ttk in TKinter?
April 22, 2021 - In tkinter applications, we use to import all tkinter functions and classes, making them directly accessible without prefixes. However, for themed widgets with modern styling, we need to separately import the ttk module.
🌐
Medium
medium.com › @VaishnavSabariGirish › from-tkinter-to-customtkinter-a-journey-to-better-uis-in-python-fd9ea6388fda
From Tkinter to CustomTkinter : A Journey to better UI’s in Python | by Vaishnav Sabari Girish | Medium
July 10, 2024 - In the above image , we have 2 kinds of button one from Tkinter and one from CustomTkinter. We can clearly see that the CTk button looks more stylish. Here’s the code for the above image : import tkinter as tk import customtkinter as ctk def print_tk() : print("Tkinter button has been pressed") def print_ctk() : print("CustomTkinter button has been pressed") win = tk.Tk() win.geometry("300x300") button_tk = tk.Button(win , text = "Tk button" , command = print_tk) button_tk.grid(row = 0 , column = 0 , padx = 75 , pady = 20) button_ctk = ctk.CTkButton(win , text = "CTk Button" , command = print_ctk) button_ctk.grid(row = 1 , column = 0 , padx = 75 , pady = 20) win.mainloop() The added advantage of CTk is that we can add rounded buttons ·
🌐
Python
wiki.python.org › moin › TkInter
Tkinter - Python Wiki
This wiki is in the process of being archived due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies. Edits are discouraged. Pages are preserved as they were at the time of archival. For current information, please visit python.org.
🌐
Medium
medium.com › @huilinglee › tkinter-8cf1e8d2d449
Tkinter. - by Whitney Lee
September 25, 2017 - from tkinter import *? A1: When importing a module, to use ‘from module’s name import *’ make us to use the contents of a module without typing the module’s name.
🌐
Rip Tutorial
riptutorial.com › getting started with tkinter
tkinter Tutorial => Getting started with tkinter
To check the Tkinter version, type the following commands in your Python REPL: ... Note: Importing Tkinter as tk is not required but is good practice as it helps keep things consistent between version.
🌐
ActiveState
activestate.com › home › resources › quick read › what is tkinter used for and how to install this python framework?
What is Tkinter used for and how to install this Python Framework? - ActiveState
January 24, 2024 - Tkinter is the de facto way in Python to create Graphical User interfaces (GUIs) and is included in all standard Python Distributions.