How to clear the screen of IDLE?

Source: Internet
Author: User
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply content: is it necessary to be so complicated?
Try
Import OS
OS. system ('cls ')
Only one more 0
---------------------------
I forgot to mention it. it only works with cmd, and IDLE does not seem to work.
Why use the built-in idle? It is convenient to integrate to vs and use command lines. Link to the original article: how to solve the python idle Screen clearing problem

When learning and using python, you must deal with Python IDLE. But using Python IDLE will encounter a common and annoying problem-how to clear the screen?
The answer is to add a clear screen extension ClearWindow for IDLE (in Issue 6143: IDLE ).
The following describes how to install and use it.
1. download clearwindow. py (Right-click the target and save it as the end of the py format. directly click it to open the script content ).
2. copy the clearwindow. py file and place it in the Python installation directory Python XXX \ Lib \ idlelib (XXX is your python version ).
3. notepad open the config-extensions.def under the Directory of Python XXX \ Lib \ idlelib (the configuration file of the IDLE extension), to prevent errors, you can copy a backup before opening it.
4. modify the config-extensions.def, add the following content at the end, and save and exit:
[ClearWindow]
Enable = 1
Enable_editor = 0
Enable_shell = 1
[ClearWindow_cfgBindings]
Clear-window =
5. open the Python IDLE. the Clear shell window ctrl + is added to the options ;.
6. enter the code in IDLE and press Ctrl +; (Ctrl and;) to clear the code you just entered.

Note:
The shortcut key Ctrl +; can be changed to another key, and the "clear-window = .
After the test, the IDLE cannot be started when the Control is changed to Alter. when the Control is changed to Shift, the shortcut key does not work because Shift + l is directly input L. You can refer to the solution to the python idle Screen clearing problem. I also hate idle when I turn it off and reopen it. if I can clear it like matlab, clc will do it in one sentence. Unfortunately, we have to install the plug-in again.

If you don't install the plug-in, I think that's all you have to do.
In the previous few cases, the file name and the first letter of ClearWindow should be capitalized to succeed. It's very troublesome. close it and restart it. If the clear command is available, the new method in 2016 will be better. python 3.5.1 + Windows
Pip install idlex

Then create a shortcut
C: \ Python3 \ pythonw.exe "c: \ Python3 \ scripts \ idlex. pyw"

Replace the path according to your actual situation.

Disadvantages: use the arrow keys to perform the input commands up and down. if there are multiple lines of input history, the command will be stuck there. Why can't I do it? what are the steps I did? There is only one Python Configure option under options. thank you. installation is complete!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.