473,769 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clearing IDLE's screen?

Hello All,

I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the
interactive prompt).
Any pointers/suggetions?

Thanks.
Miki
Jul 18 '05 #1
3 9685
mi*********@zor an.com (Miki Tebeka) writes:
I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the
interactive prompt).
Any pointers/suggetions?


Try this:

def clear():
for i in range(60):
print

If that is adequate, then you should be able to write an extension
for IDLE which would bind this function to a key.

Read .../idlelib/extend.txt for further information.

Note that if you use this approach, previous entries into the Shell
window can be retrieved by scrolling up and/or using the "View Last
Restart / F6" feature. This is useful to recall code to the command
line for re-evaluation.

The downside is the buffer can get pretty large. You have to decide
if that's a problem. It hasn't been for me. If you have an Edit
window open, you can always close the Shell window occasionally and
reopen it from the Run menu.

If you really want to clear the buffer for the Shell window, then the
Tkinter Text widget would have to be truncated. That involves a
deeper understanding of IDLE, particularly EditWindow.py,
OutputWindow.py , and PyShell.py. It is conceivable that it could be
done as an extension.
===

I have been planning on implementing an integrated Shell Clear
capability in IDLE 1.1 which would truncate the Shell Text widget.
Just re-opening the Shell window would probably move it on the screen,
so that is not very attractive.

The question for the list is, should Clear be orthogonal to Reset or
should Clear also do a Reset?

Other comments?

--
KBK
Jul 18 '05 #2
Hell Kurt,
I'd like to bind <CTRL+L> so that it will clear IDLE's screen (in the
interactive prompt). Try this:

def clear():
for i in range(60):
print

I'd like to clear the history as well.
The downside is the buffer can get pretty large. You have to decide
if that's a problem. It hasn't been for me. I've found that when the buffer is very big IDLE becomes very slow.
(Happes to me a lot, instead of
print len(open("X").r ead()) I do print open("X").read( )

)
The question for the list is, should Clear be orthogonal to Reset or
should Clear also do a Reset?

IMO it should just clear. I'd like it to remember my previous
definition and just clear the screen.

Miki
Jul 18 '05 #3
Kurt B. Kaiser wrote:
I have been planning on implementing an integrated Shell Clear
capability in IDLE 1.1 which would truncate the Shell Text widget.
Just re-opening the Shell window would probably move it on the screen,
so that is not very attractive.

The question for the list is, should Clear be orthogonal to Reset or
should Clear also do a Reset?


It should be separate. When I run something with a print spewing
far more information than I expected, I want to wipe the output.
I'd really like to just cut that part out, but clearing the text
buffer is good enough. On the other hand, I often want to repeat
the commands I just typed with slight variations. I really wouldn't
like to lose those just because I typed the name of a hopelessly
large array.

--
-Scott David Daniels
Sc***********@A cm.Org
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3233
by: Timmah | last post by:
I have a Visual Basic menu script that I am trying to get to clear the dos screen it is running in. Basically, you select an option from the menu, and after the processing is complete, a "press enter to continue" comes up. When enter is pressed I'd like the DOS screen the script is running in to clear (and the menu to be displayed again). Is there any way to do this? I've tried many different things, but I seem to have trouble actually...
4
4263
by: Ishwor | last post by:
Hi i use IDLE to code Python in my machine. What i haven't been able to do is call an in-built function called clear()/cls()/clr() because it mightn't exist. so what i did is coded my own function called cls() as such >>> def cls(): for i in range(1,40): print " "; now that does the job very nicely and i get cleared screen but what i really want to achieve it everytime i start IDLE, without importing
18
59633
by: Tim Mierzejewski | last post by:
How do I clear the text from my screen, other than a bunch of \n's or endl's? Tim M.
4
4536
by: Curious Student | last post by:
I was looking at methods of clearing the screen. I remember using clrscr() in C on a Unix machine when I was at the institute learning software development. I tried using it on MS VC++ 6.0. It didn't work. I looked up the documentation. The documentation said this is a non-standard function and is included in conio.h. I had included conio.h already, and yet it couldn't link. I guess clrscr is a unix thing then? I also found this code in...
1
2014
by: raghavendra | last post by:
Hi, i am facing problem clearing screen in console application. As, in C++ we have clrscr(); Is? their any similar type of function is avaliable.. Raghavendra...
1
1808
by: Shane | last post by:
This question must come up a bit, but I cant find a solution to the question. The nearest Ive found for clearing a dos console is at the following http://support.microsoft.com/kb/q99261/ But, it pertains to C and C++, I hope there is a way to do it in C sharp TIA -- Rule 6: There is no rule 6
6
44196
by: amby | last post by:
Hi, How do I clear the console screen in gcc compiler. It does not accept clrscr() or system(cls); I dont want to print blank lines or use putchar(' \f'); Is there any defined function in gcc like clrscr() to clear the console?
65
8643
by: Leslie Kis-Adam | last post by:
Hi everyone! Does anyone know, if it is possible to clear the screen in ANSI C? If it is,then how? Any help would be appreciated. Laszlo Kis-Adam <dfighter_AT-NOSPAM_freemail.hu
3
5062
by: writser | last post by:
hey all, For my study I'm writing a simple threaded webcrawler and I am trying to do this in python. But somehow, using threads causes IDLE to crash on Windows XP (with the latest python distribution 2.5.1). Even a simple example such as this: import thread, time def doSomething():
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8879
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.