diff options
author | Christopher Chavez <chrischavez@gmx.us> | 2023-04-24 01:31:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 01:31:44 (GMT) |
commit | f0ed293f6aec1c2ed22725301b77d6ccedc2d486 (patch) | |
tree | 28f60161855b588a730da5114cfc5f1492e6dd0a /Lib/tkinter | |
parent | bd2dca035af88694e25fb060f984fbbcda82bed8 (diff) | |
download | cpython-f0ed293f6aec1c2ed22725301b77d6ccedc2d486.zip cpython-f0ed293f6aec1c2ed22725301b77d6ccedc2d486.tar.gz cpython-f0ed293f6aec1c2ed22725301b77d6ccedc2d486.tar.bz2 |
gh-103685: Fix tkinter.Menu.index() for Tk 8.7 (#103686)
---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/tkinter')
-rw-r--r-- | Lib/tkinter/__init__.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 479daf0..bf0b3b9 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3430,8 +3430,7 @@ class Menu(Widget): def index(self, index): """Return the index of a menu item identified by INDEX.""" i = self.tk.call(self._w, 'index', index) - if i == 'none': return None - return self.tk.getint(i) + return None if i in ('', 'none') else self.tk.getint(i) # GH-103685. def invoke(self, index): """Invoke a menu item identified by INDEX and execute |