diff options
author | Guido van Rossum <guido@python.org> | 1994-06-27 07:48:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-06-27 07:48:37 (GMT) |
commit | c2fb7e65de0d57a8b8d2d118fa02f7cb8140e54f (patch) | |
tree | c832083a31c303cb125923bf6b197db46d64e02d /Lib | |
parent | 715274007636cba0e7755523c4619a2be238ef69 (diff) | |
download | cpython-c2fb7e65de0d57a8b8d2d118fa02f7cb8140e54f.zip cpython-c2fb7e65de0d57a8b8d2d118fa02f7cb8140e54f.tar.gz cpython-c2fb7e65de0d57a8b8d2d118fa02f7cb8140e54f.tar.bz2 |
(Menu.index): return int or None, not string
(Widget.__getitem__): use splitlist, not split
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 6 | ||||
-rwxr-xr-x | 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 d21c6f8..7be94c7 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -528,7 +528,7 @@ class Widget(Misc, Pack, Place): 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): @@ -877,7 +877,9 @@ class Menu(Widget): 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 d21c6f8..7be94c7 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -528,7 +528,7 @@ class Widget(Misc, Pack, Place): 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): @@ -877,7 +877,9 @@ class Menu(Widget): 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): |