Configuring PyCharm
PyCharm provides features for customizing its interface as per our convenience. We can change the code style, font type, and color of the font, add keyboard shortcuts, etc. First, in this module on ‘How to configure PyCharm?,’ we will learn how to configure the style of code.
Watch this Python Tutorial Video for Beginners:
We will be going through a top-down approach to configure PyCharm, so let’s start off by listing the topics that we will be learning in this module of PyCharm tutorial:
Configuring the Style of Code
To configure PyCharm’s code styles we will follow the below steps:
Step 1: From the toolbar, go to File > Settings > Code Style, from where, we can select our preferred language or code style. We can also go to Settings using Ctrl+Alt+S
Step 2: Then, we will go to File and Code Templates to see the template of our code
Step 3: Click on Python in the Code Style menu, from where, we can change Tab Size, Indent, Spaces, Blank Lines, and Continuation Indent
Further in this module, let’s discuss about how we can configure the font style and font color of our code.
Learn more about Python from this Data Science with Python Course and be a torchbearer among your peers!
Configuring Fonts and Colors
We write code for creating applications. The code consists of a lot of text. It contains variables, keywords, classes, and different data types. If all these parameters are represented with different colors, it becomes easy for us to understand the code. PyCharm provides us a feature to customize and configure PyCharm’s font and color.
Steps to select a color scheme:
Step 1: Go to File > Settings (or press Ctrl+Alt+S), and then go to Editor > Color Scheme
Step 2: To configure PyCharm, we can now change our color scheme to Default, Darcula, Github, High contrast, Monokai, Twilight, or WarmNeon from the drop-down list
The Default color scheme is a simple and light theme.
The Darcula color scheme is a dark theme as shown below:
PyCharm also provides a theme for users with vision deficiency, the High Contrast theme.
Step 3: We can select the theme of our choice and click on Apply
Wish to learn Python from experts? Come to our Python Course in Bangalore now!
Semantic Highlighting
The development of an application requires a lot of functions, methods, and classes. These consist of various logical operations that gives the functionality to the program. It is necessary to have a clear understanding of the program’s functionality. Thus, it becomes important to differentiate between functions, methods, and classes.
For this, PyCharm provides us with a feature of semantic highlighting. It helps us distinguish between classes, functions, variables, and keywords. In this section, we will see how to configure PyCharm for Semantic Highlighting.
Following are the steps for semantic highlighting:
Step 1: Press Ctrl+Alt+S to open Settings
Step 2: Then, go to Editor > Color Scheme > Language Defaults
Step 3: Go to Semantic highlighting and tick the checkbox of Semantic highlighting placed on the top-right corner
Step 4: Now, we can change the color of semantics by clicking on the color codes
Python is one of the most demanding skills right now in the market. Enroll in our Python Certification Course and become a Python Expert.
Customizing Keyboard Shortcuts
In this section, we will first look into the predefined keymaps. After that, we will see the configuration of shortcuts for the keyboard and the mouse.
Are you interested in learning Python? Enroll in the Python Course in London now!
Keymap Configuration
We will do the keymap configuration by going to Settings > Keymap. It consists of various predefined keymaps that are automatically selected by PyCharm. However, these predefined keymaps are not customizable.
Configuring Keyboard Shortcuts
Step 1: Open Settings and go to Keymap
Step 2: Then, go to Edit Shortcuts and click on Add Keyboard Shortcut
Step 3: Now, enter the key combination in the editor option. We can also use Second stroke for creating a complex shortcut with two-key combinations
Step 4: Click on OK to save the newly created shortcut. Remember, always use mouse pointer while creating a shortcut because using Enter will result into a new key combination with Enter as a component of this newly created shortcut
Configuring Mouse Shortcuts
Step 1: Go to Settings and right-click on Keymap
Step 2: Then, right-click on Edit Shortcuts and click on Add Mouse Shortcut
Step 3: When a dialog box appears to add a Mouse Shortcut, take the mouse pointer at the center of the dialog box and add the shortcut
Step 4: Click on OK to save the newly created shortcut
In this module, we have learned how to configure PyCharm. We have also learned adding keyboard and mouse shortcuts and configuring semantic highlighting for the text. In the next module of this PyCharm tutorial, we will learn how to configure PyCharm projects.