Write text to text widget. The text is inserted at the given index with the provided tags. The text widget is then scrolled to make it visible and updated to display it, giving the effect of seeing each line as it is added. Args: s: Text to inse
(self, s, tags=(), mark="insert")
| 94 | |
| 95 | # Act as output file |
| 96 | def write(self, s, tags=(), mark="insert"): |
| 97 | """Write text to text widget. |
| 98 | |
| 99 | The text is inserted at the given index with the provided |
| 100 | tags. The text widget is then scrolled to make it visible |
| 101 | and updated to display it, giving the effect of seeing each |
| 102 | line as it is added. |
| 103 | |
| 104 | Args: |
| 105 | s: Text to insert into text widget. |
| 106 | tags: Tuple of tag strings to apply on the insert. |
| 107 | mark: Index for the insert. |
| 108 | |
| 109 | Return: |
| 110 | Length of text inserted. |
| 111 | """ |
| 112 | assert isinstance(s, str) |
| 113 | self.text.insert(mark, s, tags) |
| 114 | self.text.see(mark) |
| 115 | self.text.update() |
| 116 | return len(s) |
| 117 | |
| 118 | def writelines(self, lines): |
| 119 | "Write each item in lines iterable." |
no test coverage detected