-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
import tkinter as tk
root = tk.Tk()
print("background" in root)Prints the following stack trace:
Traceback (most recent call last):
File "/example.py", line 3, in <module>
print("background" in root)
^^^^^^^^^^^^^^^^^^^^
File "/tkinter/__init__.py", line 1727, in cget
return self.tk.call(self._w, 'cget', '-' + key)
~~~~^~~~~
TypeError: can only concatenate str (not "int") to strThe TypeError referencing concatenation of an int to a str is very misleading. Error messages that don't make sense can be very confusing especially for beginners who don't know about magic methods like __iter__ and __getitem__.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancementA feature request or enhancement