Is there a horizontal scroll bar in python's idle?
Solution 1
Horizontal Scroll Bars for IDLE
from http://code.activestate.com/lists/python-list/26878/ (not my code, found it on this site) It is dated Wed, 08 Mar 2000
Works for Python 2.6 but I can't get to work in 2.7. I get an error saying that the file is open some where. For me, the file he is talking about is located in:C:\Python27\ArcGIS10.1\Lib\idlelib It will be different if you do not have the ArcMap program which comes with python and installs it for you.
I finally got around to adding horizontal scroll bars to the IDLE editor window to help when you get those LONG lines of code. They changes are rather mionor (4 new lines of code) and were made in the EditorWindow.py module. To make the changes in IDLE, open EditorWindow.py and perform a search for 'vbar' which is in the EditorWindow class,
__init__
method. Add those lines that have###
appended to them and VOILA you have it. Unfortunately, the scrollbar appears BELOW the row and column information in IDLE 0.5 (sigh).self.vbar = vbar = Scrollbar(top, name='vbar') self.hbar = hbar = Scrollbar(top, orient=HORIZONTAL, name='hbar') ### ... vbar['command'] = text.yview vbar.pack(side=RIGHT, fill=Y) hbar['command'] = text.xview ### hbar.pack(side=BOTTOM, fill=X) ### text['yscrollcommand'] = vbar.set text['xscrollcommand'] = hbar.set ###
Hope this is helpful.
Jonathan Polley
jwpolley at collins.rockwell.com
Solution 2
No. IDLE does not have horizontal scrollbars for two reasons:
- Its text editor has few features.
- You shouldn't be writing long lines of code. See the Maximum Line Length section of the PEP 8 Style Guide for Python Code
Solution 3
I'm using IDLE 2.7.3, Windows 7, and I can scroll horizontally by holding down the center mouse button/scroll wheel, and "dragging" around the cursor like that.
Solution 4
I may not be a Python expert/guru yet but this question is a user-experience / usability question more than anything. Some might say "Yeah, PEP 8 style guide... blah blah blah" but if I have the IDLE window a certain size (let's say small width), there's no reason I as a user shouldn't be able to scroll. It's simply poor user-experience as a result of poor design.
Solution 5
No, the text scrolls horizontally based on where the insertion point or selection is.
marl
Updated on June 15, 2022Comments
-
marl almost 2 years
I am using IDLE to learn Python 2.7 on Windows 7.
The Vertical scroll bar works fine but I cannot find
a way to activate the Horizontal scroll bar.Is there a horizontal scroll bar in Python's IDLE?
Thanks
-
marl about 12 yearsGood to know the about the style guide and the recommendation.
-
marl about 12 yearsI was trying to fit both brower and IDLE on same screen to type in code from tutorials. Find typing works better for learning purposes than cut and paste. Thanks for your advice
-
marl about 12 yearsOk, so I should use cursor, home and end keys to move horizontally?
-
kindall about 12 yearsYes, or you can use the mouse by dragging. And of course you can just make the window wider.
-
ysap almost 10 yearsWorks like a charm in Python 3.4.1!
-
jpe about 5 yearsI've added a version for Pytrhon 3.6: stackoverflow.com/a/54755273/1264516
-
boboquack about 4 yearsFor Python 3.8.0, you now need to change the
hbar.pack(side=BOTTOM, fill=X)
line tohbar.grid(row=2, column=1, sticky=NSEW)
-
uzumaki about 3 yearsSometimes people just don't want IDLE to use up 50+% of screen real estate.