IDLE is an integrated development environment (an application like a wordprocessor which helps developers to write programs) for Python. IDLE is the Python IDE which comes with Python, built with the tkinter GUI toolkit. It has two modes Interactive and Development.
IDLE features :
- Cross Platform : Works on Unix and Windows.
- Multi-window text editor with syntax highlighting and smart indent and other.
- Python shell window with syntax highlighting.
- Integrated debugger.
- Coded in Python, using the tkinter GUI toolkit
Python IDLE : Interactive Mode
Let us assume that we've already installed Python (here we installed Python 3.2 on a standard pc with windows 7 OS). Click on start button and find Python 3.2 tab in installed programs.
Now clicking on Python 3.2 tab you can see the Python program development tool named IDLE (Python GUI).
To start IDLE click on IDLE (Python GUI) icon, you will see a new window opens up and the cursor is waiting beside '>>>' sign which is called command prompt.
This mode is called interactive mode as you can interact with IDLE directly, you type something (single unit in programming language) and press enter key Python will execute it, but you can not execute your entire program here. At command prompt type copyright and press enter key Python executes the copyright information.
Now Python is ready to read new command. Lets execute the following commands one by one.
Command -1 : print("Hello World")
Command -2 : primt("Hello World")
First command is correct and but second one has syntax error, here is the response from Python.
Before go to Development mode see the details of Python IDLE Menus
- New window : Create a new editing window. Shortcut key : Ctrl+N
- Open : Open an existing file. Shortcut key : Ctrl+O
- Recent Files : List of recent open files.
- Open module : Open an existing module. Shortcut key : Alt+M
- Class browser : Show classes and methods in current file. shortcut key : Alt+C
- Path browser : Show sys.path directories, modules, classes and methods.
- Save : Save current window to the associated file. Shortcut key : Ctrl+S
- Save As : Save current window to new file, which becomes the associated file. Shortcut key : Ctrl+shift+S
- Save Copy As : Save current window to different file without changing the associated file. Shortcut key : Alt+shift+S
- Print window. Shortcut key : Ctrl+P
- Close : Close current window (asks to save if unsaved). Shortcut key : Alt+F4
- Exit : Close all windows and quit IDLE (asks to save if unsaved). Shortcut key : Ctrl+Q
- Undo : Undo last change to current window (max 1000 changes). Shortcut key : Ctrl+Z
- Redo : Redo last undone change to current window. Shortcut key : Ctrl+shift+Z
- Cut : Copy selection into system-wide clipboard; then delete selection. Shortcut key : Ctrl+X
- Copy : Copy selection into system-wide clipboard. Shortcut key : Ctrl+C
- Paste : Insert system-wide clipboard into window. Shortcut key : Ctrl+V
- Select All: All Select the entire contents of the edit buffer. Shortcut key : Ctrl+A
- Find... : Open a search dialog box with many options. Shortcut key : Ctrl+F
- Find again : Repeat last search. Shortcut key : Ctrl+G
- Find selection : Search for the string in the selection. Shortcut key : Ctrl+F3
- Find in Files... : Open a search dialog box for searching files. Shortcut key : Alt+F3
- Replace...: Open a search-and-replace dialog box. Shortcut key : Ctrl+H
- Go to line : Ask for a line number and show that line. Shortcut key : Alt+G
- Expand word : Expand the word you have typed to match another word in the same buffer; repeat to get a different expansion
- Show call tip. Shortcut key : Ctrl+backslash
- Show surrounding parens. Shortcut key : Ctrl+0
- Show completions. Shortcut key : Ctrl+space
- View Last Restart. Shortcut key : F6
- Restart shell. Shortcut key : Ctrl+F6
- Go to file/line look around the insert point for a filename and line number, open the file, and show the line.
- Stack viewer show the stack traceback of the last exception
- Auto open stack viewer.
- Configure IDLE
- Zoom height. Shortcut key : Alt+2
- Python shell.
- About IDLE.
- IDLE Help.
- Python Documents. Shortcut key : F1
Python IDLE : Development mode
At first, start with a new window.
Clicking on "New window" under file menu a new window will come. Type print "Hello World" in the new window.
Let's save (Save command is located under the File menu) the file now. We save the program as helloworld.py under E:/python-programs folder.
To run the program select Run menu.
Now click on Run Module or press F5 as shortcut key to see the result.
Python IDLE : Syntax and Shell Colors
Python command line interface
There are some users who prefer command line intersection, rather than a GUI interface. To go Python command line, click on Python 3.2 tab then click on Python(command line).
Here is the screen shot of Python command line interface. To return type exit() or Ctrl+Z plus Enter key.
photo credit: IvanWalsh.com. Photo is used under creative Common License.