]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(Menu.index): return int or None, not string
authorGuido van Rossum <guido@python.org>
Mon, 27 Jun 1994 07:48:37 +0000 (07:48 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 27 Jun 1994 07:48:37 +0000 (07:48 +0000)
(Widget.__getitem__): use splitlist, not split

Lib/lib-tk/Tkinter.py
Lib/tkinter/Tkinter.py

index d21c6f82c7a483a2c1a51e1eb1007f6a445a1280..7be94c75034699d36d753ffaf3c74bee7a57bdc9 100644 (file)
@@ -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):
index d21c6f82c7a483a2c1a51e1eb1007f6a445a1280..7be94c75034699d36d753ffaf3c74bee7a57bdc9 100755 (executable)
@@ -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):