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

Method __init__

Lib/idlelib/textview.py:34–69  ·  view source on GitHub ↗

Create a frame for Textview. master - master widget for this frame wrap - type of text wrapping to use ('word', 'char' or 'none') All parameters except for 'wrap' are passed to Frame.__init__(). The Text widget is accessible via the 'text' attribute. Note:

(self, master, wrap=NONE, **kwargs)

Source from the content-addressed store, hash-verified

32 """Display text with scrollbar(s)."""
33
34 def __init__(self, master, wrap=NONE, **kwargs):
35 """Create a frame for Textview.
36
37 master - master widget for this frame
38 wrap - type of text wrapping to use ('word', 'char' or 'none')
39
40 All parameters except for 'wrap' are passed to Frame.__init__().
41
42 The Text widget is accessible via the 'text' attribute.
43
44 Note: Changing the wrapping mode of the text widget after
45 instantiation is not supported.
46 """
47 super().__init__(master, **kwargs)
48
49 text = self.text = Text(self, wrap=wrap)
50 text.grid(row=0, column=0, sticky=NSEW)
51 self.grid_rowconfigure(0, weight=1)
52 self.grid_columnconfigure(0, weight=1)
53
54 # vertical scrollbar
55 self.yscroll = AutoHideScrollbar(self, orient=VERTICAL,
56 takefocus=False,
57 command=text.yview)
58 self.yscroll.grid(row=0, column=1, sticky=NS)
59 text['yscrollcommand'] = self.yscroll.set
60
61 # horizontal scrollbar - only when wrap is set to NONE
62 if wrap == NONE:
63 self.xscroll = AutoHideScrollbar(self, orient=HORIZONTAL,
64 takefocus=False,
65 command=text.xview)
66 self.xscroll.grid(row=1, column=0, sticky=EW)
67 text['xscrollcommand'] = self.xscroll.set
68 else:
69 self.xscroll = None
70
71
72class ViewFrame(Frame):

Callers

nothing calls this directly

Calls 7

TextClass · 0.90
superClass · 0.85
AutoHideScrollbarClass · 0.85
grid_rowconfigureMethod · 0.80
grid_columnconfigureMethod · 0.80
__init__Method · 0.45
gridMethod · 0.45

Tested by

no test coverage detected