Home  >  Article  >  Backend Development  >  Introduction to how to add screen clearing function in Python

Introduction to how to add screen clearing function in Python

巴扎黑
巴扎黑Original
2017-08-07 17:30:451707browse

The following editor will bring you an example of adding the screen clearing function to IDEL in Python. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look.

Just add a screen-clearing extension ClearWindow to idle (you can see the description of this extension in http://bugs.python.org/issue6143).
Below I will talk about the installation and use methods. First download clearwindow.py (click to download directly, if you cannot download it, you can right-click to save, the format ends with py), put this file in the Python X\Lib\idlelib directory (X is your python version), and then in this directory Find the file config-extensions.def (the idle extension configuration file), and open it in Notepad (to prevent errors, you can copy a backup before opening it). Well, it may look dense after opening it. If possible, it is recommended that you use an editor like Notepad++ or vim to open it.

Open config-extensions.def and add the following sentences at the end:


[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>

Then save and exit.

Open python's idle and see if there is an additional option in options: clear shell window ctrl+L

If this is the case, it proves that your installation is successful. You will need to clear the screen directly in the future. Just ctrl+L.

The above is the detailed content of Introduction to how to add screen clearing function in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn