From 535cf0cbe218c81f3b70bfa2fe7ef45636713ad3 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 27 Jun 1994 07:55:59 +0000 Subject: [PATCH] Redo these changes: (Menu.index): return int or None, not string (Widget.__getitem__): use splitlist, not split --- Lib/lib-tk/Tkinter.py | 6 ++++-- Lib/tkinter/Tkinter.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 4d2dd3ab1a1..2c3390b0903 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -583,7 +583,7 @@ def config(self, cnf=None): apply(self.tk.call, (self._w, 'configure') + self._options(cnf)) def __getitem__(self, key): - v = self.tk.split(self.tk.call( + v = self.tk.splitlist(self.tk.call( self._w, 'configure', '-' + key)) return v[4] def __setitem__(self, key, value): @@ -940,7 +940,9 @@ def entryconfig(self, index, cnf={}): apply(self.tk.call, (self._w, 'entryconfigure', index) + self._options(cnf)) def index(self, index): - return self.tk.call(self._w, 'index', index) + i = self.tk.call(self._w, 'index', index) + if i == 'none': return None + return self.tk.getint(i) def invoke(self, index): return self.tk.call(self._w, 'invoke', index) def post(self, x, y): diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index 4d2dd3ab1a1..2c3390b0903 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -583,7 +583,7 @@ def config(self, cnf=None): apply(self.tk.call, (self._w, 'configure') + self._options(cnf)) def __getitem__(self, key): - v = self.tk.split(self.tk.call( + v = self.tk.splitlist(self.tk.call( self._w, 'configure', '-' + key)) return v[4] def __setitem__(self, key, value): @@ -940,7 +940,9 @@ def entryconfig(self, index, cnf={}): apply(self.tk.call, (self._w, 'entryconfigure', index) + self._options(cnf)) def index(self, index): - return self.tk.call(self._w, 'index', index) + i = self.tk.call(self._w, 'index', index) + if i == 'none': return None + return self.tk.getint(i) def invoke(self, index): return self.tk.call(self._w, 'invoke', index) def post(self, x, y):