mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Misc.__init__(): Removed method, replaced with class attribute (which
was all that the method set anyway). Removed calls to the constructor. This reduces the number of Python function calls per widget construction by one, for every widget construction.
This commit is contained in:
parent
84bf42531c
commit
526749b678
2 changed files with 2 additions and 8 deletions
|
@ -119,8 +119,7 @@ def getboolean(s):
|
|||
return _default_root.tk.getboolean(s)
|
||||
|
||||
class Misc:
|
||||
def __init__(self):
|
||||
self._tclCommands = None
|
||||
_tclCommands = None
|
||||
def destroy(self):
|
||||
if self._tclCommands is not None:
|
||||
for name in self._tclCommands:
|
||||
|
@ -661,7 +660,6 @@ class Wm:
|
|||
class Tk(Misc, Wm):
|
||||
_w = '.'
|
||||
def __init__(self, screenName=None, baseName=None, className='Tk'):
|
||||
Misc.__init__(self)
|
||||
global _default_root
|
||||
self.master = None
|
||||
self.children = {}
|
||||
|
@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid):
|
|||
self.master.children[self._name].destroy()
|
||||
self.master.children[self._name] = self
|
||||
def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
|
||||
Misc.__init__(self)
|
||||
if kw:
|
||||
cnf = _cnfmerge((cnf, kw))
|
||||
self.widgetName = widgetName
|
||||
|
|
|
@ -119,8 +119,7 @@ def getboolean(s):
|
|||
return _default_root.tk.getboolean(s)
|
||||
|
||||
class Misc:
|
||||
def __init__(self):
|
||||
self._tclCommands = None
|
||||
_tclCommands = None
|
||||
def destroy(self):
|
||||
if self._tclCommands is not None:
|
||||
for name in self._tclCommands:
|
||||
|
@ -661,7 +660,6 @@ class Wm:
|
|||
class Tk(Misc, Wm):
|
||||
_w = '.'
|
||||
def __init__(self, screenName=None, baseName=None, className='Tk'):
|
||||
Misc.__init__(self)
|
||||
global _default_root
|
||||
self.master = None
|
||||
self.children = {}
|
||||
|
@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid):
|
|||
self.master.children[self._name].destroy()
|
||||
self.master.children[self._name] = self
|
||||
def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
|
||||
Misc.__init__(self)
|
||||
if kw:
|
||||
cnf = _cnfmerge((cnf, kw))
|
||||
self.widgetName = widgetName
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue