Search code examples
pythonpython-idle

Is there a horizontal scroll bar in python's idle?


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


Solution

  • 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