Home

How to Start IDLE in Python

|
|  Updated:  
2021-12-28 16:54:09
Python Essentials For Dummies
Explore Book
Buy On Amazon
You find IDLE in the Python 3.10 folder on your system as IDLE (Python 3.10 64-bit). When you click or double-click this entry (depending on your platform), you see the IDLE editor. The two lines of text contain information about the Python host and provide suggestions on the commands you can try.

The precise information you see differs by platform. What you see may differ depending on the version of Python you use, the platform you use, how you have IDLE configured, and how you have your system configured.

image0.jpg

Using standard commands

IDLE provides all the same commands as the command-line version of Python. It doesn’t list them all because the assumption is that you’ll use the GUI features of IDLE to make things easy. However, if you want, you can type help() and press Enter to enter help mode, even though this command isn’t listed as one of the initial commands for IDLE as it is for the command-line version.

image1.jpg

Understanding color coding

Color coding lets you see commands with greater ease and differentiate commands from other sorts of text. Press Enter to get out of help mode. As with the command-line version, you see descriptive text each time you perform an action.

Now, type print ('This is some text.') and press Enter. You see the expected output, just as you normally would. Notice the color coding, though. The print() command is in purple text to show that it’s a command. The text within the print() command is green to show that it’s data and not a command.

The output is shown in blue. The color coding makes things a lot easier, which is just one of many reasons that using IDLE is easier than using the command line.

image2.jpg

Getting GUI help

IDLE makes obtaining the help you need easy. Look at the Help menu and you see three entries for obtaining help:
  • About IDLE: Provides you with the latest information about IDLE.

  • IDLE Help: Shows you a text file containing information about working with the IDLE IDE. For example, this is where you find a list of the IDLE commands.

  • Python Docs: Contains information required to work with Python commands and other elements.

Choose Help→About IDLE to see the About IDLE dialog box. Near the middle of the dialog box, you see URLs for obtaining additional help. Each of the buttons displays a text file containing useful information, especially in the README and NEWS files. Click Close to exit this dialog box.

image3.jpg

Precisely what you see when you choose Help→Python Docs depends on the platform you use. The Python Docs file contains information about how to work with and use Python to create applications. It even has a tutorial section in which you can find additional helpful tips.

image4.jpg

Configuring IDLE

IDLE is basically a fancy text editor, when you think about it, so it’s not surprising that you can configure it to perform the task of editing text better. Choose Options→Configure IDLE to see the IDLE Preferences dialog box. This is where you can choose things like what font IDLE uses when displaying text.

image5.jpg IDLE uses color coding to make reading and understanding the code easier. This tab lets you choose the colors used to perform highlighting. Notice that you can save your selections as a theme. You can create different themes for different needs. For example, you may use one theme when you use your laptop or other computing device in bright conditions and another theme in low light conditions. image6.jpg

Even though you won’t see shortcut keys, IDLE does support them. The shortcut keys on your platform may differ. IDLE comes with built-in key sets for Windows, Mac, OS X, and Unix. You can choose any of these themes by clicking the small button next to the IDLE Classic Windows entry. You can also create your own custom theme that’s based on another application you use.

image7.jpg

The Windows tab controls window preferences. For example, you can tell IDLE to open a Python Shell window (so that you can experiment) or an Edit window (so that you can write an application). The default is to open a Python Shell window so that you can experiment with Python and try new techniques.

The Shell/Ed tab is where you can control whether IDLE prompts you to save files before running applications (a good idea in case the application causes the system to freeze) and the size of the initial window when you create one. The defaults you see normally work just fine, so there really isn’t a good reason to change them.

image8.jpg

The Help Menu Extensions feature in the Extensions tab lets you create new help sources. You can create a link to an online source, such as Python’s online documentation. To add a new source, click Add. You see the New Help Source dialog box where you can add the text that appears on the Help menu for this information source and the location of that source on a hard drive or online.

When you finish adding the source, click OK and you’ll see it added to the IDLE Help menu. There are also buttons on the General tab of the IDLE Preferences dialog box for editing and removing help sources.

image9.jpg

About This Article

This article is from the book: 

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.