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)
| 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 | |
| 72 | class ViewFrame(Frame): |
nothing calls this directly
no test coverage detected