SoFunction
Updated on 2024-11-16

Handling of screen clearing in python 3.4

Clear the screen under IDLE:

# Online some first define the function, and then ?print ("\n" * 100) output a hundred line feed method is a bit of bullshit, and even press enter is not much different, the cursor can not go back to the first line.

# Still the following method is more practical. After the operation, just use ctrl+L to clear the screen.

# The method of clearing the screen under IDLE is still relatively easy, so please bear with me as I present it below in a combination of pictures and text:

1.First download

2. Then put the file in the Python X\Lib\idlelib directory (X is your python version)

The default installation path of python: C:\Users\Administrator\AppData\Local\Programs\Python\PythonX\Lib\idlelib)

3. Then find this file in this directory

Open it in notepad (you can copy a backup before opening it to prevent errors).

After opening, add these words at the end of the sentence:

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

Then just save and quit.

4. Reopen python's IDLE and see if options has an extra option clear shell window ctrl+L

If this is the case, then it proves that you have successfully installed it, and in the future, if you want to clear the screen, you can just press ctrl+L directly.

Content Extension:

A python implementation of clear screen

A try:

>>> import os
>>> ('cls')

It will come up:

0
>>>

Try again:

>>> import os
>>> i = ('cls')

It's clean, it's clean, yo!

To summarize: use the system's clear screen command.

to this article on python3.4 screen clearing method of handling the article is introduced to this, more related python3.4 how to clear the screen content please search for my previous articles or continue to browse the following related articles I hope you will support me in the future more!