diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 3bd0a0cd39c8e0..2a8681fb4f2535 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -29,6 +29,7 @@ from idlelib.tree import wheel_event from idlelib.util import py_extensions from idlelib import window +from idlelib.textview import AutoHideScrollbar # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 @@ -136,7 +137,19 @@ def __init__(self, flist=None, filename=None, key=None, root=None): } self.text = text = MultiCallCreator(Text)(text_frame, **text_options) self.top.focused_widget = self.text - + # Create a scrollbar that is automatically hidden when not needed + # with idlelib.textview.AutoHideScrollbar + if text['wrap'] == 'none': + self.horizontalbar = horizontalbar = AutoHideScrollbar( + text_frame, + name='horizontalbar', + orient='horizontal', + command=text.xview) + horizontalbar.grid(row=2, column=1, sticky=NSEW) + text['xscrollcommand'] = horizontalbar.set + else: + self.horizontalbar = None + self.createmenubar() self.apply_bindings()