The Tkinter library is built-in with every Python installation. And since you are on Windows, I believe you installed Python through the binaries on their website?
If so, Then most probably you are typing the command wrong. It should be:
import Tkinter as tk
Note the capital T at the beginning of Tkinter.
For Python 3,
import tkinter as tk
Answer from icyflame on Stack OverflowThe Tkinter library is built-in with every Python installation. And since you are on Windows, I believe you installed Python through the binaries on their website?
If so, Then most probably you are typing the command wrong. It should be:
import Tkinter as tk
Note the capital T at the beginning of Tkinter.
For Python 3,
import tkinter as tk
If you are using virtualenv, it is fine to install tkinter using sudo apt-get install python-tk(python2), sudo apt-get install python3-tk(python3), and and it will work fine in the virtual environment
How do i install Tkinter
Installing tkinter
Videos
How do i install Tkinter i watched tutorials but it doesnt match mine python 3.10
Hello everyone,
How can I install tkinter on python 3.8 and windows 7(64 bit), could you elaborate more on the steps?
Thank you
tkinter is a built-in python module. so when you install python, tkinter is installed too. here is more clarification:
when you want to install python you have 2 option:
- Install Now: this is some kind of standard installation. most of the programs have it.
- Customize Installation: when using this option you can choose which modules to install. in this picture, you will see
tcl/tk and IDLEwhich containstkintermodule. make sure it is checked!
- you can see here there is nothing wrong with using tkinter and PyCharm.
if you still get the error, I suggest reinstalling your python. probably the best way.
tkinter is built-in in python so no need to install it. Also, I have Windows 10 and I have just finished doing a massive project with tkinter and pycharm and it as worked fine. Be aware tho, when you are trying to import tkinter watch out for the suggestion that pycharm tries to give you: the right name for the module is tkinter and not _tkinter