<s> """<STR_LIT>""" <EOL> __all__ = [ '<STR_LIT>' ] <EOL> from Tkinter import Frame , Text , Scrollbar , Pack , Grid , Place <EOL> from Tkconstants import RIGHT , LEFT , Y , BOTH <EOL> class ScrolledText ( Text ) : <EOL> def __init__ ( self , master = None , ** kw ) : <EOL> self . frame = Frame ( master ) <EOL> self . vbar = Scrollbar ( self . frame ) <EOL> self . vbar . pack ( side = RIGHT , fill = Y ) <EOL> kw . update ( { '<STR_LIT>' : self . vbar . set } ) <EOL> Text . __init__ ( self , self . frame , ** kw ) <EOL> self . pack ( side = LEFT , fill = BOTH , expand = True ) <EOL> self . vbar [ '<STR_LIT>' ] = self . yview <EOL> text_meths = vars ( Text ) . keys ( ) <EOL> methods = vars ( Pack ) . keys ( ) + vars ( Grid ) . keys ( ) + vars ( Place ) . keys ( ) <EOL> methods = set ( methods ) . difference ( text_meths ) <EOL> for m in methods : <EOL> if m [ <NUM_LIT:0> ] != '<STR_LIT:_>' and m != '<STR_LIT>' and m != '<STR_LIT>' : <EOL> setattr ( self , m , getattr ( self . frame , m ) ) <EOL> def __str__ ( self ) : <EOL> return str ( self . frame ) <EOL> def example ( ) : <EOL> import __main__ <EOL> from Tkconstants import END <EOL> stext = ScrolledText ( bg = '<STR_LIT>' , height = <NUM_LIT:10> ) <EOL> stext . insert ( END , __main__ . __doc__ ) <EOL> stext . pack ( fill = BOTH , side = LEFT , expand = True ) <EOL> stext . focus_set ( ) <EOL> stext . mainloop ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> example ( ) </s>
