Set the delegate for this instance. A delegate is an instance of a Delegator class and each delegate points to the next delegator in the stack. This allows multiple delegators to be chained together for a widget. The bottom delegate for a colorizer is a Text
(self, delegate)
| 136 | self.colorizing = False |
| 137 | |
| 138 | def setdelegate(self, delegate): |
| 139 | """Set the delegate for this instance. |
| 140 | |
| 141 | A delegate is an instance of a Delegator class and each |
| 142 | delegate points to the next delegator in the stack. This |
| 143 | allows multiple delegators to be chained together for a |
| 144 | widget. The bottom delegate for a colorizer is a Text |
| 145 | widget. |
| 146 | |
| 147 | If there is a delegate, also start the colorizing process. |
| 148 | """ |
| 149 | if self.delegate is not None: |
| 150 | self.unbind("<<toggle-auto-coloring>>") |
| 151 | Delegator.setdelegate(self, delegate) |
| 152 | if delegate is not None: |
| 153 | self.config_colors() |
| 154 | self.bind("<<toggle-auto-coloring>>", self.toggle_colorize_event) |
| 155 | self.notify_range("1.0", "end") |
| 156 | else: |
| 157 | # No delegate - stop any colorizing. |
| 158 | self.stop_colorizing = True |
| 159 | self.allow_colorizing = False |
| 160 | |
| 161 | def config_colors(self): |
| 162 | "Configure text widget tags with colors from tagdefs." |
nothing calls this directly
no test coverage detected