- Install Tkinter on Ubuntu Linux Install Tkinter on Ubuntu and other Debian-based Linux distributions
- Install Tkinter via apt
- Purchasing Power Parity
- Never miss an update
- Как установить Tkinter в Python для Windows
- Установка Tkinter в Windows
- Install Tkinter
- Install Tkinter on Windows
- Install Tkinter on Linux
- Install Tkinter on Mac Operating System
- Install Tkinter in Pycharm
- Pip Install Tkinter
- Pre-requisites
- Python
- Pip
- Check for Built-in Tkinter Package
- Installing Tkinter with Pip
- Testing the Tkinter Package
- Conclusion
- About the author
- Abdul Mannan
- Python tkinter module install
- Learn Latest Tutorials
- Preparation
- Trending Technologies
- B.Tech / MCA
- Javatpoint Services
- Training For College Campus
Install Tkinter on Ubuntu Linux
Install Tkinter on Ubuntu and other Debian-based Linux distributions
Before you start the Tkinter tutorial you will need to have a working installation of PyQt5 on your system. If you don’t have either set up yet, the following steps will guide you through how to do this on Linux.
This guide is also available for macOS. On Windows, Tkinter is installed by default with Python.
Install Tkinter via apt
Packages for Tkinter are available in the repositories of most distributions. In Ubuntu you can install either from the command line or via «Software Center». The package you are looking for is named python3-tk .
You can also install these from the command line as follows —
sudo apt install python3-tk
After install is finished, you should be able to run python3 (or python ) and import tkinter without errors.
Python 3.7.6 Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>>
Purchasing Power Parity
Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Never miss an update
Enjoyed this? Subscribe to get new updates straight in your Inbox.
Install Tkinter on Ubuntu Linux was written by Martin Fitzpatrick .
Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.
Install Tkinter on Ubuntu Linux was published in installation on May 21, 2019 (updated March 16, 2023 )
- Topics
- Where do I begin?
- Data Science
- Packaging & Distribution
- Databases & SQL
- QML/QtQuick
- Learn the fundamentals
- Raspberry Pi
- Games
- Start
Follow us for new tutorials
Как установить Tkinter в Python для Windows
Tkinter – это стандартная библиотека Python, которая используется для приложения с графическим интерфейсом. Tkinter с Python предлагает простой и быстрый способ создания приложений с графическим интерфейсом.
Tk GUI работает на основе объектно-ориентированного подхода, что делает его мощной библиотекой. Tkinter широко доступен для всех операционных систем. Он предварительно установлен в Python. Для работы с Tkinter мы должны установить Python. В этом руководстве мы узнаем, как установить Tkinter в Python для Windows.
Чтобы создать удобное приложение с графическим интерфейсом пользователя, вы должны иметь базовые знания языка программирования Python.
Установка Tkinter в Windows
Tkinter поставляется с установщиком Python. Нам просто нужно установить Python с www.python.org, Tkinter идет вместе с Python. Устанавливать отдельно не нужно. Установите флажок tcl / tk и IDE.
Чтобы проверить Tkinter, нам просто нужно импортировать его в текстовый редактор или IDE.
Теперь мы можем получить доступ к его функциям для создания виджета. Давайте разберемся в следующем.
from tkinter import * root = Tk() # Code to add widget will go here…….. w = Label(root, width = "40", height = "15") w.pack() root.mainloop()
Все элементы будут размещены в этом окне Tkinter.
Install Tkinter
- Install Tkinter on Windows
- Install Tkinter on Linux
- Install Tkinter on Mac Operating System
- Install Tkinter in Pycharm
This tutorial will demonstrate how to install Tkinter on multiple platforms. Every platform has individual commands to install Tkinter in Python.
Install Tkinter on Windows
Tkinter offers multiple GUI libraries to develop GUI applications. The Tkinter is one of the popular libraries to build GUI system interfaces.
To install Tkinter, we have to install Python; if it is already installed, we can move on to install Tkinter. When we start the installation of Python, we can check td or tk and IDLE Tkinter during installation.
This way, this Tkinter will come along with Python packages, and we do not need to install it separately. However, if we lose installing Tkinter during the installation of Python, we can do it later using the pip command.
We can confirm the Python version using this command.
Pip ’s version is checked using this command.
Now we are ready to install Tkinter.
Now we can use the tkinter library. To confirm the tkinter library is installed, write the code in the shell.
import tkinter tkinter._test()
If you are an Anaconda user, you can use the following command.
conda install -c anaconda tk
Install Tkinter on Linux
There are different variants of the Linux operating system. This section will learn how to install Tkinter in multiple variants.
Use this command if you’re using a Debian-based Linux operating system.
# python2 user sudo apt-get install python-tk
# python3 user sudo apt-get install python3-tk
Use this command if you’re using one of these: RHEL, CentOS, Oracle Linux.
sudo yum install -y tkinter tk-devel
The Fedora-based Linux operating system uses this command.
Use this command to confirm the tkinter library is installed successfully.
Install Tkinter on Mac Operating System
There are two ways to install the tkinter library in MacOS. The Mac user will follow these steps.
Run the below command to check that python3 is installed.
Run the below command to check that pip3 is installed.
If your pip is outdated, please upgrade your pip using the below command.
We will use pip3 as the first method. Write the following command to install Tkinter.
The second method needs a setup.py file to install the Tkinter.
We have to download the latest version of Tkinter in python3 using this command.
curl https://files.pythonhosted.org/packages/a0/81/ 742b342fd642e672fbedecde725ba44db44e800dc4c936216c3c6729885a/tk-0.1.0.tar.gz > tk.tar.gz
Write the following command to extract the downloaded package.
Go to the extracted folder and run this command.
To ensure the tkinter library is installed, run this code in the Python terminal.
Install Tkinter in Pycharm
The installation process is very simple in Pycharm IDLE. Pycharm IDLE is more convenient for users.
There is an interface to install the tkinter library without running a command.
Go to File>Settings>Project>Python Interpreter and click the + button, search tk , and click the Install Package button. You can select the specific version.
Click here to read more about Tkinter.
Hello! I am Salman Bin Mehmood(Baum), a software developer and I help organizations, address complex problems. My expertise lies within back-end, data science and machine learning. I am a lifelong learner, currently working on metaverse, and enrolled in a course building an AI application with python. I love solving problems and developing bug-free software for people. I write content related to python and hot Technologies.
Pip Install Tkinter
The “Tkinter” package/library of python is used to develop the Graphical User Interfaces of python-based applications with great ease and control. What most people don’t realize is that the Tkinter package comes pre-installed in python 3.7 or higher, and if that is not the case, then it can be separately downloaded using the Pip commands.
Pre-requisites
There are a few pre-reqs for installing and using the Tkinter Package, and these pre-reqs include:
Python
Python must be installed in the user’s PC to not only install Tkinter but also to use it. To verify if python is installed on the PC or not, run the following command inside a Command Prompt or any other terminal:
The above command will produce the following results if python is installed:
Pip
After python, ensure that pip is also installed on the PC by using the following command inside the Command Prompt or any other terminal:
The output confirms that pip is installed on the user’s PC.
Check for Built-in Tkinter Package
As mentioned above, the Tkinter package also comes pre-installed with python 3.7 and higher. This essentially means that the user might not need to explicitly install the Tkinter package as it may already be installed on his machine. To verify this, run the following command inside the Command Prompt:
If the tkinter package is already installed, then the above command will result in the following output:
If the output is an error, then that means that the tkinter package is not pre-installed on your PC.
Installing Tkinter with Pip
Once you have made sure that you have all the prerequisites installed and also that there is no built-in tkinter with your python package, simply install the Tkinter using the following pip command:
Alternatively, you can also use the following command:
Both of the above commands will download and install the Tkinter package on your PC:
Testing the Tkinter Package
To test that the tkinter package has been successfully installed and is working, simply open up a python shell, by typing in “python” in a command prompt window:
After that, import the tkinter package and launch a new frame using the following lines:
After that, the following window will open up:
The window contains a demo GUI from the tkinter package, which contains two buttons, “Click me!” and “QUIT,” and two statements that display the version of the TK or the TCL package. The current version installed is the “Tcl 8.6”
Conclusion
The “pip install tkinter” command is used to install the tkinter package in python, a Graphical User Interface builder package that provides many features to the developer. However, this Tkinter package, also known as Tcl or TK package, comes as a built-in module with python 3.7 and higher. Therefore, the user might not necessarily need to install the tkinter package separately. This post has pictorially represented the purpose and the usage for the “pip install tkinter” command.
About the author
Abdul Mannan
I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor’s degree in computer science.
Python tkinter module install
Learn Latest Tutorials
Preparation
Trending Technologies
B.Tech / MCA
Javatpoint Services
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
- Website Designing
- Website Development
- Java Development
- PHP Development
- WordPress
- Graphic Designing
- Logo
- Digital Marketing
- On Page and Off Page SEO
- PPC
- Content Development
- Corporate Training
- Classroom and Online Training
- Data Entry
Training For College Campus
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week
Like/Subscribe us for latest updates or newsletter