[issue44592] tkinter focus_get() with non-tkinter Tk widget

E. Paine report at bugs.python.org
Fri Jul 9 15:44:29 EDT 2021


E. Paine <xepaine13 at gmail.com> added the comment:

I agree with Akuli that raising a KeyError is not expected behaviour (combined with the fact this is caught elsewhere), and therefore is probably a regression.

While we could use `winfo class` to determine the type of Tk widget, this would probably require a reasonably sized refactor of tkinter (and we would still need to support cases when it's a type we don't know). Therefore, I think returning `None` is the best solution.

Akuli, would you like to create a pull request for this?

----------
nosy: +epaine, serhiy.storchaka
versions: +Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44592>
_______________________________________


More information about the Python-bugs-list mailing list