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

Class ScrollableTextFrame

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

Display text with scrollbar(s).

Source from the content-addressed store, hash-verified

29
30
31class ScrollableTextFrame(Frame):
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 3

create_page_fontMethod · 0.90
create_page_highlightMethod · 0.90
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…