MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/idlelib/textview.py:74–98  ·  view source on GitHub ↗

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.

(self, parent, contents, wrap='word')

Source from the content-addressed store, hash-verified

72class ViewFrame(Frame):
73 "Display TextFrame and Close button."
74 def __init__(self, parent, contents, wrap='word'):
75 """Create a frame for viewing text with a "Close" button.
76
77 parent - parent widget for this frame
78 contents - text to display
79 wrap - type of text wrapping to use ('word', 'char' or 'none')
80
81 The Text widget is accessible via the 'text' attribute.
82 """
83 super().__init__(parent)
84 self.parent = parent
85 self.bind('<Return>', self.ok)
86 self.bind('<Escape>', self.ok)
87 self.textframe = ScrollableTextFrame(self, relief=SUNKEN, height=700)
88
89 text = self.text = self.textframe.text
90 text.insert('1.0', contents)
91 text.configure(wrap=wrap, highlightthickness=0, state='disabled')
92 color_config(text)
93 text.focus_set()
94
95 self.button_ok = button_ok = Button(
96 self, text='Close', command=self.ok, takefocus=False)
97 self.textframe.pack(side='top', expand=True, fill='both')
98 button_ok.pack(side='bottom')
99
100 def ok(self, event=None):
101 """Dismiss text viewer dialog."""

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 9

color_configFunction · 0.90
ButtonClass · 0.90
superClass · 0.85
ScrollableTextFrameClass · 0.85
bindMethod · 0.45
insertMethod · 0.45
configureMethod · 0.45
focus_setMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected