Kaydet (Commit) 526749b6 authored tarafından Fred Drake's avatar Fred Drake

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.
üst 84bf4253
...@@ -119,8 +119,7 @@ def getboolean(s): ...@@ -119,8 +119,7 @@ def getboolean(s):
return _default_root.tk.getboolean(s) return _default_root.tk.getboolean(s)
class Misc: class Misc:
def __init__(self): _tclCommands = None
self._tclCommands = None
def destroy(self): def destroy(self):
if self._tclCommands is not None: if self._tclCommands is not None:
for name in self._tclCommands: for name in self._tclCommands:
...@@ -661,7 +660,6 @@ class Wm: ...@@ -661,7 +660,6 @@ class Wm:
class Tk(Misc, Wm): class Tk(Misc, Wm):
_w = '.' _w = '.'
def __init__(self, screenName=None, baseName=None, className='Tk'): def __init__(self, screenName=None, baseName=None, className='Tk'):
Misc.__init__(self)
global _default_root global _default_root
self.master = None self.master = None
self.children = {} self.children = {}
...@@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid): ...@@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid):
self.master.children[self._name].destroy() self.master.children[self._name].destroy()
self.master.children[self._name] = self self.master.children[self._name] = self
def __init__(self, master, widgetName, cnf={}, kw={}, extra=()): def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
Misc.__init__(self)
if kw: if kw:
cnf = _cnfmerge((cnf, kw)) cnf = _cnfmerge((cnf, kw))
self.widgetName = widgetName self.widgetName = widgetName
......
...@@ -119,8 +119,7 @@ def getboolean(s): ...@@ -119,8 +119,7 @@ def getboolean(s):
return _default_root.tk.getboolean(s) return _default_root.tk.getboolean(s)
class Misc: class Misc:
def __init__(self): _tclCommands = None
self._tclCommands = None
def destroy(self): def destroy(self):
if self._tclCommands is not None: if self._tclCommands is not None:
for name in self._tclCommands: for name in self._tclCommands:
...@@ -661,7 +660,6 @@ class Wm: ...@@ -661,7 +660,6 @@ class Wm:
class Tk(Misc, Wm): class Tk(Misc, Wm):
_w = '.' _w = '.'
def __init__(self, screenName=None, baseName=None, className='Tk'): def __init__(self, screenName=None, baseName=None, className='Tk'):
Misc.__init__(self)
global _default_root global _default_root
self.master = None self.master = None
self.children = {} self.children = {}
...@@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid): ...@@ -907,7 +905,6 @@ class Widget(Misc, Pack, Place, Grid):
self.master.children[self._name].destroy() self.master.children[self._name].destroy()
self.master.children[self._name] = self self.master.children[self._name] = self
def __init__(self, master, widgetName, cnf={}, kw={}, extra=()): def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
Misc.__init__(self)
if kw: if kw:
cnf = _cnfmerge((cnf, kw)) cnf = _cnfmerge((cnf, kw))
self.widgetName = widgetName self.widgetName = widgetName
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment