Tkinter is a Python library that allows you to write GUI interfaces for Windows, Unix, and Linux operating systems.
The Tkinter library is built-in with every Python installation, so it’s already installed in PyCharm per default. This means that you have to do nothing else but to run “
import tkinter” or “
import tkinter as tk” in your Python 3 script without installation.
(Just ignore the
AttributeError in the console—I tried to check the TKinter version but it didn’t have the
__version__ attribute. ? )
If just importing the Tkinter library doesn’t work for you, chances are that you’re using Python 2 in which case you may want to try the capitalized form “
import Tkinter” like so:
Of course, you can also try to manually install Tkinter in the PyCharm “Terminal” view using either of the following:
pip install python-tk
pip install python3-tk
sudo apt-get install python-tk
sudo apt-get install python3-tk
Feel free to check out the following free email academy with Python cheat sheets to boost your coding skills!
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.