Skip to content

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

Open
@Akuli

Description

@Akuli

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false positiveType checkers report false errorstopic: tkintertkinter-related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions