Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
Bug report
Whentkinter get's a keyword argument, it tries to convert it to a string that tcl/tk can handle. The problem is that when a callable object is passed in as the value for a keyword argument,tkinter usually calls an internal_register method but it's missing from theImage class.Here intkinter/__init__.py,tkinter tries to callself._register(v) but there is no method named_register in theImage class. There is a_register method forMisc andVariable butImage doesn't inherit from any of those. A minimal reproducible example:
importtkinterroot=tkinter.Tk()tkinter.PhotoImage(height=print)
The expected error is:_tkinter.TclError: expected integer but got "140140827421696print" but it's throwingAttributeError: 'PhotoImage' object has no attribute '_register'.
The only time this bug would appear is when someone makes a mistake and callsPhotoImage orBitmapImage with a callable keyword parameter. So the only difference is the error message.
Your environment
The issue isn't environment dependant.
- CPython versions tested on: 3.10 but from the source code, it should be present in all 3.7+ versions of cpython.