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

Method set_width

Lib/idlelib/editor.py:318–329  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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()

Callers 3

__init__Method · 0.95
handle_winconfigMethod · 0.95
ResetFontMethod · 0.95

Calls 4

FontClass · 0.90
winfo_widthMethod · 0.80
cgetMethod · 0.45
measureMethod · 0.45

Tested by

no test coverage detected