473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 9641
mi*********@zoran.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").read()) 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***********@Acm.Org
Jul 18 '05 #4

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

Similar topics

1
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...
4
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...
18
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
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...
1
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
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...
6
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...
65
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
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.