Skip to content

tkinter.PhotoImage.put: the to argument can accept a four-tuple #13962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Akuli opened this issue May 9, 2025 · 1 comment
Open

tkinter.PhotoImage.put: the to argument can accept a four-tuple #13962

Akuli opened this issue May 9, 2025 · 1 comment
Labels
help wanted An actionable problem of low to medium complexity where a PR would be very welcome stubs: false positive Type checkers report false errors topic: tkinter tkinter-related issues

Comments

@Akuli
Copy link
Collaborator

Akuli commented May 9, 2025

The following code shows a green square:

import tkinter

root = tkinter.Tk()
img = tkinter.PhotoImage(width=300, height=300)
img.put('green', to=(100, 100, 200, 200))  # This doesn't type-check like it should
tkinter.Label(root, image=img).pack()
root.mainloop()

When running type checker, there should be no errors, but I get a mypy error:

a.py:5: error: Argument "to" to "put" of "PhotoImage" has incompatible type "tuple[int, int, int, int]"; expected "tuple[int, int] | None"  [arg-type]

Related: #13931

@Akuli Akuli added topic: tkinter tkinter-related issues help wanted An actionable problem of low to medium complexity where a PR would be very welcome stubs: false positive Type checkers report false errors labels May 9, 2025
@VelikiiNehochuha
Copy link
Contributor

#13971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted An actionable problem of low to medium complexity where a PR would be very welcome stubs: false positive Type checkers report false errors topic: tkinter tkinter-related issues
Projects
None yet
Development

No branches or pull requests

2 participants