02_Pycharm commonly used personalized configurations
Article directory
- 02_Pycharm commonly used personalized configurations
-
- 1. Pycharm adjusts font size
- 2. Pycharm adjusts font size settings through mouse wheel
- 3. Pycharm sets code comment template
- 4. Pycharm sets new .py file template
- 5. Configure the opening method of the project in pycharm (This Window, New Window)
- 6. The new version of pycharm restores the old version interface
1. Pycharm adjusts font size
How to adjust font size in Pycharm.
1. Open pycharm, click File in the upper left corner, and then click Settings.
2. When the Settings pop-up box appears, click Editor, then click Font on the right.
3. After the Font pop-up box appears, set its size. The font on the right will become larger or smaller accordingly. Finally, click OK.
2. Pycharm adjusts font size settings through mouse wheel
Navigate to "General" under the "editor" tab and check the "change font size with..." option.
3. Pycharm sets code comment template
How to set up code comment templates, function comments, etc. in Pycharm.
1. In the settings setting–>tools–> as shown below:
Note: Plain does not have annotation templates.
PyCharm itself comes with four forms of template styles.
These four styles are Epytext, restructuredText, Numpy, and Google. The four styles are different. Friends can choose the settings they like.
def test1(param1=None,param2=None):
'''
Epytext注释模板
@param param1:
@param param2:
@return:
'''
print('函数注释测试')
return None
def test2(param1=None,param2=None):
'''
restructedText注释模板
:param param1:
:param param2:
:return:
'''
print('函数注释测试')
return None
def test3(param1=None,param2=None):
'''
Numpy注释模板
Parameters
----------
param1
param2
Returns
-------
'''
print('函数注释测试')
return None
def test4(param1=None,param2=None):
'''
Google注释模板
Args:
param1:
param2:
Returns:
'''
print('函数注释测试')
return None
4. Pycharm sets new .py file template
PyCharm sets default author information and script templates. When creating a new .py file, template information will be added by default.
PyCharm >> Preferences/Settings >> Editor >> File and Code Templates >> Python Script >> Setting content >> Click Apply.
Commonly used variable names are listed below:
Format | Annotation content |
---|---|
${PROJECT_NAME} | The name of the current project |
${DIR_PATH} | Project path |
${NAME} | current file name |
${USER} | Currently logged in user name |
${DATE} | Current system date |
${TIME} | Current system time |
${YEAR} | The year when the file was created |
${MONTH} | The month in which the file was created |
${DAY} | The day of the month when the file was created |
${HOUR} | Current hour |
${MINUTE} | Current minutes |
${SECOND} | Current seconds |
${PRODUCT_NAME} | The name of the IDE that created the file |
${MONTH_NAME_SHORT} | December (month abbreviation) |
${MONTH_NAME_FULL} | December (full name of month) |
Examples are as follows:
5. Configure the opening method of the project in pycharm (This Window, New Window)
When creating a new project or opening a project, there is no his Window or a solution to the New Window prompt box.
File–>Setting–>Appearance & Behavior -->System Setting in the upper left corner, select Ask in the right window, click Apply, and then click OK
This will ask questions every time. If you want to open it in a new window every time or open it in the current window every time, you can also choose the first two.
6. The new version of pycharm restores the old version interface
The new version of pycharm2022.3 uses the new UI by default (as shown below):
How to restore the old version interface:
Click the red box in the upper left corner, select "file" –> setting -> New UI -> uncheck Enable new UI and then restart the IED.