Saturday 19 May 2012


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.7.3


"I finally got around to adding horizontal scroll bars to the IDLE editor window to help when you get those LONG lines of code and very small boxes when transcribing/reading. The changes are rather minor (4 new lines of code) and were made in the EditorWindow.py module.
First  renamed EditorWindow.pyc  to EditorWindow_org.pyc

To make the code changes in IDLE, I opened EditorWindow.py  in Notepad++
and performed 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.

Jonathan P.

(Stack Overflow answer by Amber)
















Code Listing:
    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   ###

No comments:

Post a Comment