diff options
author | Guido van Rossum <guido@python.org> | 1995-09-18 21:54:35 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-18 21:54:35 (GMT) |
commit | 71b1a90bad57e547085fde4f6e4a6d562b11467a (patch) | |
tree | 37eadf97892913db9979c96adf793ca7de473f2b /Lib/lib-tk/Tkinter.py | |
parent | 1c9daa8ba685f17fe2c41aafae66beee808e6fc7 (diff) | |
download | cpython-71b1a90bad57e547085fde4f6e4a6d562b11467a.zip cpython-71b1a90bad57e547085fde4f6e4a6d562b11467a.tar.gz cpython-71b1a90bad57e547085fde4f6e4a6d562b11467a.tar.bz2 |
added getitem/setitem to Image class; changed call wrapping (again)
Diffstat (limited to 'Lib/lib-tk/Tkinter.py')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index abe8f82..3b52ae1 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -425,7 +425,7 @@ class Misc: name = tail return w def _register(self, func, subst=None): - f = CallWrapper(func, subst, self).__call__ + f = self._wrap(func, subst) name = `id(f)` if hasattr(func, 'im_func'): func = func.im_func @@ -474,6 +474,8 @@ class Misc: exc, val, tb = sys.exc_type, sys.exc_value, sys.exc_traceback root = self._root() root.report_callback_exception(exc, val, tb) + def _wrap(self, func, subst=None): + return CallWrapper(func, subst, self).__call__ class CallWrapper: def __init__(self, func, subst, widget): @@ -1269,6 +1271,10 @@ class Image: def __del__(self): if self.name: self.tk.call('image', 'delete', self.name) + def __setitem__(self, key, value): + self.tk.call(self.name, 'configure', '-'+key, value) + def __getitem__(self, key): + return self.tk.call(self.name, 'configure', '-'+key) def height(self): return self.tk.getint( self.tk.call('image', 'height', self.name)) |