What is IDLE?
IDLE stands for Iintegrated D.eveL.option E.Surroundings. It’s an IDE for Python written in the Python language itself and based on Tkinter with bindings to the Tk widget set. IDLE is best for beginners because it is easy to use and not cluttered. Hence, it is very popular in educational settings.
IDLE is a cross-platform IDE solution with a basic set of functions that includes:
- Multi-window text editor with syntax highlighting, auto-completion, smart indentation, and other features that make coding easier.
- Python shell with syntax highlighting.
- Integrated debugger with stepping, persistent breakpoints and visibility of the call list.
For more information on IDLE, see the following official documentation:
In this article, we’re going to install IDLE from the Ubuntu command line. The article also explains how to start IDLE and use it to write and run a simple Python script.
We ran the commands and procedures mentioned in this article on an Ubuntu 18.04 or Ubuntu 20.04 system.
How do I install IDLE?
Python is installed by default on all latest versions of Ubuntu, and it usually comes with the IDLE application as well. However, if you have a minimal installation of Ubuntu that doesn’t lack an IDLE UI application, you can install it using this method:
Open the Ubuntu command line, The Terminal, either from the System Dash or the keyboard shortcut Ctrl + Alt + T.
Then you need to update your system’s repository index as sudo using the following command:
$ sudo apt-get update
This will bring your system’s repository in line with the internet repositories and will help you install the latest version of any software available.
You need to run this command as sudo as only an authorized user can add / remove, update, and configure software on Ubuntu. The system will ask you for the password for sudo and then run the rest of the command if you entered a correct password.
The next step is to run the following command to install IDLE3. This is the most suitable version if you have either Python 2 or Python 3 installed on your system.advertising
$ sudo apt-get install idle3
The system may ask for Y / n to make sure that you really want to install the software. Please enter Y and then press Enter and IDLE3 will be installed on your system.
You can start IDLE from both the command line and the Ubuntu user interface.
Run the following command in the terminal to start IDLE.
Or, enter keywords relevant to IDLE in your Ubuntu Dash search as follows:
This will list all of the IDLE applications installed on your system. Click on one of them to start 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 where you see the three symbols “greater than” or “>”.
Place the cursor here and write or copy and paste the following line of code:
print("This is my first Python program :) :)")
This is a simple print statement that can be used to print anything inside the brackets “()” on the screen.
When you press Enter, the output will look like this:
You can even save the program (via the Save / Save As option on the File menu) and access it later (via the Open option on the File menu or click on it directly where you saved it).
After reading this article, you can use the IDLE Python development environment into your Ubuntu system and make the most of the UI-based, simple and user-friendly feature set.