(self, parent, contents, wrap='word')
Create a frame for viewing text with a "Close" button.

        parent - parent widget for this frame
        contents - text to display
        wrap - type of text wrapping to use ('word', 'char' or 'none')

        The Text widget is accessible via the 'text' attribute.
Create a frame for viewing text with a "Close" button.
Create a frame for viewing text with a Close button .
def __init__(self, parent, contents, wrap='word'):
        """Create a frame for viewing text with a "Close" button.

        parent - parent widget for this frame
        contents - text to display
        wrap - type of text wrapping to use ('word', 'char' or 'none')

        The Text widget is accessible via the 'text' attribute.
        """
        super().__init__(parent)
        self.parent = parent
        self.bind('<Return>', self.ok)
        self.bind('<Escape>', self.ok)
        self.textframe = ScrollableTextFrame(self, relief=SUNKEN, height=700)

        text = self.text = self.textframe.text
        text.insert('1.0', contents)
        text.configure(wrap=wrap, highlightthickness=0, state='disabled')
        color_config(text)
        text.focus_set()

        self.button_ok = button_ok = Button(
                self, text='Close', command=self.ok, takefocus=False)
        self.textframe.pack(side='top', expand=True, fill='both')
        button_ok.pack(side='bottom')
def __init__ ( self , parent , contents , wrap = 'word' ) : super ( ) . __init__ ( parent ) self . parent = parent self . bind ( '<Return>' , self . ok ) self . bind ( '<Escape>' , self . ok ) self . textframe = ScrollableTextFrame ( self , relief = SUNKEN , height = 700 ) text = self . text = self . textframe . text text . insert ( '1.0' , contents ) text . configure ( wrap = wrap , highlightthickness = 0 , state = 'disabled' ) color_config ( text ) text . focus_set ( ) self . button_ok = button_ok = Button ( self , text = 'Close' , command = self . ok , takefocus = False ) self . textframe . pack ( side = 'top' , expand = True , fill = 'both' ) button_ok . pack ( side = 'bottom' )