Table of contents
IDLE, short for Integrated DeveLopment Environment, is a Python IDE developed using the Python programming language and built on Tkinter with bindings to the Tk widget set. It's particularly user-friendly and lightweight, making it an ideal choice for beginners, which is why it's widely used in educational settings.
IDLE is a cross-platform IDE that offers a basic yet effective set of features, including:
A multi-window text editor with syntax highlighting, auto-completion, smart indenting, and other tools designed to simplify coding.
A Python shell that supports syntax highlighting.
An integrated debugger that provides features like step-by-step execution, persistent breakpoints, and visibility of the call stack.
In this guide, we'll walk you through the process of installing the IDLE Python IDE using the Ubuntu command line. Additionally, we'll show you how to launch IDLE and use it to write and execute a simple Python script.
The commands and steps provided here have been tested on Ubuntu 20.04 and 22.04 systems.
How to Install IDLE?
Python is pre-installed on most recent Ubuntu releases, and typically, the IDLE application is included. However, if you're using a minimal installation of Ubuntu that doesn't have the IDLE UI application, you can easily install it using the following method:
First, open the Ubuntu command line, known as the Terminal, either through the system Dash or by using the Ctrl+Alt+T shortcut.
Next, update your system's repository index by running the following command with sudo privileges:
$ sudo apt-get update
This way, your system’s repository gets in line with the Internet repositories, and helps you install the latest version of any available software.
You need to run this command with sudo because only an authorized user can add, remove, update, and configure software on Ubuntu. When you enter the command, the system will prompt you for your sudo password. After providing the correct password, the command will proceed to execute.
Once your repository index is updated, the next step is to install IDLE3, which is the most compatible version whether you have Python 2 or Python 3 installed on your system. You can do this by running the following command:
$ sudo apt-get install idle3
The system might ask you for a Y/n input to make sure that you indeed want to install the software. Please enter Y and then hit Enter, after which IDLE3 will be installed on your system.
Launch IDLE
You can launch IDLE both through the command line or the Ubuntu UI.
Run the following command in the Terminal in order to launch IDLE.
$ idle
Or else, enter keywords relevant to IDLE in your Ubuntu Dash search as follows:
This will list all the IDLE applications installed on your system. Click on any one of them to Launch the Python integrated development environment.
Your first Python program in IDLE
Open the IDLE application, which by default looks like this:
Your first line of code starts from where you see the three “greater than” or “>” symbols.
Place the cursor at this point and write or copy & paste the following line of code:
print("This is my first Python program :) :)")
This simple print statement can be used to print anything inside the parentheses “( )”, on the screen.
When you hit Enter, the output is displayed as follows:
You can save your Python program using the "Save" or "Save As" option from the File menu, allowing you to access it later. To reopen it, you can use the "Open" option from the File menu or simply click on the file from its saved location.
By following this guide, you'll be able to integrate the
IDLE Python development environment
into your Ubuntu system and take full advantage of its user-friendly, UI-based features.