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

Method _setup

Lib/tkinter/__init__.py:2815–2845  ·  view source on GitHub ↗

Internal function. Sets up information about children.

(self, master, cnf)

Source from the content-addressed store, hash-verified

2813 """Internal class."""
2814
2815 def _setup(self, master, cnf):
2816 """Internal function. Sets up information about children."""
2817 if master is None:
2818 master = _get_default_root()
2819 self.master = master
2820 self.tk = master.tk
2821 name = None
2822 if 'name' in cnf:
2823 name = cnf['name']
2824 del cnf['name']
2825 if not name:
2826 name = self.__class__.__name__.lower()
2827 if name[-1].isdigit():
2828 name += "!" # Avoid duplication when calculating names below
2829 if master._last_child_ids is None:
2830 master._last_child_ids = {}
2831 count = master._last_child_ids.get(name, 0) + 1
2832 master._last_child_ids[name] = count
2833 if count == 1:
2834 name = '!%s' % (name,)
2835 else:
2836 name = '!%s%d' % (name, count)
2837 self._name = name
2838 if master._w=='.':
2839 self._w = '.' + name
2840 else:
2841 self._w = master._w + '.' + name
2842 self.children = {}
2843 if self._name in self.master.children:
2844 self.master.children[self._name].destroy()
2845 self.master.children[self._name] = self
2846
2847 def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
2848 """Construct a widget with the parent widget MASTER, a name WIDGETNAME

Callers 4

__init__Method · 0.95
__init__Method · 0.45
_setupMethod · 0.45
__init__.pyFile · 0.45

Calls 5

_get_default_rootFunction · 0.85
isdigitMethod · 0.80
lowerMethod · 0.45
getMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected