IDLE is an integrated development environment that is bundled with the Windows and macOS Python distributions (it’s readily available in most Linux distributions as well, usually as IDLE or IDLE3). IDLE is written in Python using Tkinter, and it provides us with not only an editing environment for Python, but also a great example of Tkinter in action. So, while IDLE’s rudimentary feature set may not be considered professional grade by many Python coders, and while you may already have a preferred environment for writing Python code.
Let’s get familiar with IDLE’s two primary modes: shell mode and editor mode.
- When you launch IDLE, you begin in shell mode, which is simply a Python Read-Evaluate-Print-Loop (REPL) similar to what you get when you type python in a terminal window.
- Editor mode is for creating Python script files, which you can later run. When the book tells you to create a new file, this is the mode you’ll use. To open a new file in the editor mode, simply navigate to File | New File in the menu or hit Ctrl + N on the keyboard.
If you encounter below error:
idle3: command not found
you may try installing the below package as per your choice of distribution.
|Debian||apt-get install idle3|
|Ubuntu||apt-get install idle3|
|Arch Linux||pacman -S idle3|
|Kali Linux||apt-get install idle3|
|Fedora||dnf install idle3|
|Raspbian||apt-get install idle3|
A key aspect of programming is being able to test and debug your code, and a useful tool to achieve this is a debugger. The IDLE editor (make sure you use IDLE3 to support the Python 3 code) includes a basic debugger. It allows you to step through your code, observe the values of local and global variables, and set breakpoints.
The Integrated Development and Learning Environment (IDLE) has been the default IDE for Python since version 1.5.2. It is written in Python itself using the Tkinter GUI toolkit and is intended to be a simple IDE for beginners.
IDLE features a multi-window text editor with auto-completion, syntax highlighting, and smart indent. IDLE should be familiar to anyone that has used Python. There are two versions of IDLE in Raspbian, one for Python 2 and the other for Python 3. Both programs are accessed from Application Menu | Programming.