(self)
| 316 | self.set_width() |
| 317 | |
| 318 | def set_width(self): |
| 319 | text = self.text |
| 320 | inner_padding = sum(map(text.tk.getint, [text.cget('border'), |
| 321 | text.cget('padx')])) |
| 322 | pixel_width = text.winfo_width() - 2 * inner_padding |
| 323 | |
| 324 | # Divide the width of the Text widget by the font width, |
| 325 | # which is taken to be the width of '0' (zero). |
| 326 | # http://www.tcl.tk/man/tcl8.6/TkCmd/text.htm#M21 |
| 327 | zero_char_width = \ |
| 328 | Font(text, font=text.cget('font')).measure('0') |
| 329 | self.width = pixel_width // zero_char_width |
| 330 | |
| 331 | def new_callback(self, event): |
| 332 | dirname, basename = self.io.defaultfilename() |
no test coverage detected