How to Customize Python IDLE
For more information on concepts covered in this lesson, you can check out:
00:00 How to Customize Python IDLE. There are many ways that you can give IDLE a visual style that suits you. The default look and feel is based on the colors in the Python logo.
00:12 If you don’t like how anything looks, then you can almost always change it. To access the customization window, select Options → Configure IDLE from the menu on Windows and Linux, or IDLE → Preferences on macOS.
00:32 To preview the result of a change you want to make, press Apply. When you’re done customizing IDLE, press Ok to save your changes or Cancel if you want to discard them.
00:44 There are multiple ways to customize IDLE. This lesson will focus on five of them: fonts, highlights, keys, windows, and shell and editor. Extending the functionality of IDLE is a subject all on its own.
01:01 If you’d like to learn more about customizing IDLE using extensions, check out the link seen on-screen. The first tab on the preferences window allows you to change font size and font style.
01:14 You can change the font to almost any style you’d like, depending on what’s installed on your operating system. The font settings window is seen on-screen.
01:23 You can use the scrolling window to select the font you prefer. I recommend you select a fixed-width font, such as Courier New or any of the freely available dedicated programming-orientated fonts, which are clear, fixed-width, and have other features dedicated to clean-looking code editing. Pick a font size that’s large enough for you to see well.
01:44 You can also click the checkbox next to Bold to toggle whether or not all text appears in bold.
01:51 The second customization tab will let you change highlights. Syntax highlighting is an important feature of any IDE that highlights the syntax of the language you’re working in.
02:03 This helps you visually distinguish between the different Python constructs and the data used in your code. IDLE allows you to fully customize the appearance of your Python code.
02:13 It comes pre-installed with three different highlight themes: IDLE CLassic, IDLE Dark,
02:26 You can select from these pre-installed themes or create your own custom theme right in this window. Unfortunately, IDLE doesn’t allow you to install custom themes from a file.
02:36 You have to create custom themes from this window. To do so, start changing the colors for different items. Select an item, and then press Choose Color for:.
02:48 You’ll be brought to a color picker where you can select the exact color that you want to use. You’ll then be prompted to save this theme as a new custom theme, and you can enter a name of your choosing.
02:59 You can then continue changing the colors of different items if you’d like. Remember to press Apply to see your changes in action.
03:08 The third customization tab lets you map different keypresses to actions, also known as keyboard shortcuts. These are a vital component of your productivity. Whenever you use an IDE, you can either come up with your own keyboard shortcuts, or you can use the ones that come with IDLE.
03:25
The pre-installed shortcuts are a good place to start. The keyboard shortcuts are listed in alphabetical order by action. They’re listed in the format action
- <Shortcut>
, where action
is what will happen when you press the key combination in <Shortcut>
.
03:39 If you want to use a built-in key set and select a mapping that matches your operating system. Pay close attention to the different keys and make sure your keyboard has them.
03:49 The customization of keyboard shortcuts is very similar to the customization of syntax-highlighting colors. Unfortunately, IDLE doesn’t allow you to install custom keyboard shortcuts from a file.
04:00 You must create them from the Keys tab. Select one pair from the list and press Get New Keys for Selection. A new window will pop up. Here, you can use the checkboxes and scrolling menu to select the combination of keys that you want to use for the shortcut on-screen.
04:18
You can see the dedent
command being changed to use Shift and Tab, which is consistent with many other editors. As with highlights, once you create a custom key entry, you’ll be prompted to save a new custom key set, as seen on-screen.
04:34 The fourth tab of the customization window is a place for small general changes. Here you can customize things like the window size and whether the shell or the file editor opens first when you start Python IDLE.
04:47 Most of the things in this window are not that exciting to change, but they will be useful when you do need them. This window will also let you change how many spaces are used for each indentation level. By default, this will be set to the PEP 8 standard of four spaces.
05:02 You can change this to make the width of your code more or less spread out to your liking. The next tab has some options to do with the editor and shell.
05:13 Auto-Squeeze will reduce large amounts of text to a single button, which can be clicked to view that text. This can be useful if you have a script which is producing a great deal of output.
05:28 Double-clicking the squeeze notification shows the full text, as seen on-screen.
05:34 There are other options here for the editor, one of which may be useful is to show line numbers in new windows.
05:43 In the next section of the course, we’ll take a look back at what you’ve covered.
Become a Member to join the conversation.