MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/tkinter/font.py:69–98  ·  view source on GitHub ↗
(self, root=None, font=None, name=None, exists=False,
                 **options)

Source from the content-addressed store, hash-verified

67 return options
68
69 def __init__(self, root=None, font=None, name=None, exists=False,
70 **options):
71 if root is None:
72 root = tkinter._get_default_root('use font')
73 tk = getattr(root, 'tk', root)
74 if font:
75 # get actual settings corresponding to the given font
76 font = tk.splitlist(tk.call("font", "actual", font))
77 else:
78 font = self._set(options)
79 if not name:
80 name = "font" + str(next(self.counter))
81 self.name = name
82
83 if exists:
84 self.delete_font = False
85 # confirm font exists
86 if self.name not in tk.splitlist(tk.call("font", "names")):
87 raise tkinter._tkinter.TclError(
88 "named font %s does not already exist" % (self.name,))
89 # if font config info supplied, apply it
90 if font:
91 tk.call("font", "configure", self.name, *font)
92 else:
93 # create new font (raises TclError if the font exists)
94 tk.call("font", "create", self.name, *font)
95 self.delete_font = True
96 self._tk = tk
97 self._split = tk.splitlist
98 self._call = tk.call
99
100 def __str__(self):
101 return self.name

Callers

nothing calls this directly

Calls 5

_setMethod · 0.95
getattrFunction · 0.85
strFunction · 0.85
nextFunction · 0.85
callMethod · 0.45

Tested by

no test coverage detected