-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
tkinter: Simplify wm_iconphoto()
#11508
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
We should do the same thing for >>> import os
>>> os.execl(file='foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen os>", line 548, in execl
ValueError: execv() arg 2 must not be empty
>>> os.execl('bar', file='foo')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: execl() got multiple values for argument 'file' |
Cc. @sobolevn |
I think the proper solution is to use |
The current signature after #11505 specifies that |
@AlexWaygood mypy correctly handles this case: https://mypy-play.net/?mypy=latest&python=3.12&gist=6133cabb92b165e44e240d341383fe31 It is a general rule: you cannot pass keyword args if you also pass |
Hmm, fair enough. I still feel like the signature for the |
I always forget about IDE users, since I don't use one :) |
The whole method is just weird. The
default
argument is a boolean cannot be passed as a keyword argument:Also, the
default
argument must be given. So calling this method looks likewindow.wm_iconphoto(False, some_image)
orwindow.wm_iconphoto(False, image1, image2, image3)
.Having a required positional-only boolean parameter is dumb, but tkinter does it, and it can't be changed without breaking backwards compatibility.
See also the discussion in #11506.