Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-43457: Tkinter: fix design flaws in wm_attributes()#111404

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commentedOct 27, 2023
edited by github-actionsbot
Loading

  • w.wm_attributes() without arguments returns a dict instead of a tuple or a str.
  • When called with a single argument to get a value, it allow to omit the minus prefix.
  • It can be called with keyword arguments to set attributes.

📚 Documentation preview 📚:https://cpython-previews--111404.org.readthedocs.build/

* w.wm_attributes() without arguments returns a dict instead of a tuple  or a str.* When called with a single argument to get a value, it allow to omit  the minus prefix.* It can be called with keyword arguments to set attributes.
@terryjreedy
Copy link
Member

terryjreedy commentedOct 28, 2023
edited
Loading

To me, the changes are all good and at least a decade overdue. For instance, it upgrades w.wm_attributes to work like w.config. This issuecomment gives more details.

The sticky part is immediately changing the return object of a no-arg call. This should be a plus for interactive uses and for new programmatic uses. However, it will break existing code that probes the structure of the return object.

The default requirement ofPEP 387 is a deprecation period. The alternative (the last sentence): "If a warning cannot be provided to users, consult with the steering council." In this case, () cannot both give the old return with a warning and give the new return. So giving a warning would mean either not returning a dict until 3.15 (not nice) or temporarily requiring some temporary signal to get a dict. If None were intended to be used indefinitely to get the old return, the signal would have to be something else, like passing the dict class. (Yes, a bit ugly.)

I believe there is precedent to making an immediate change when the alternative is seen as worse. Part of the trade-off in such a decision would be knowing how common programmatic uses there are (and better, about how many of those would be broken). (There are core devs who have scripts to do such searches.) "Consulting with the security council" should begin with a post to the Python Core Dev discord.

(edit: sorry for the mis-click)

@serhiy-storchaka
Copy link
MemberAuthor

@gpshead, I implementedyour suggestion. Do you mind to review it?

@terryjreedy, please make yet one look at it.

@serhiy-storchakaserhiy-storchaka merged commitb4ba0f7 intopython:mainFeb 5, 2024
@serhiy-storchakaserhiy-storchaka deleted the tkinter-wm_attributes branchFebruary 5, 2024 16:25
@terryjreedy
Copy link
Member

Sorry I did not get back to this. Looks like the best we could do under the costraints.

Copy link
Member

@gpsheadgpshead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

thanks for doing this!

fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull requestFeb 14, 2024
…H-111404)* When called with a single argument to get a value, it allow to omit  the minus prefix.* It can be called with keyword arguments to set attributes.* w.wm_attributes(return_python_dict=True) returns a dict instead of   a tuple (it will be the default in future).* Setting wantobjects to 0 no longer affects the result.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gpsheadgpsheadgpshead left review comments

@terryjreedyterryjreedyAwaiting requested review from terryjreedy

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@serhiy-storchaka@terryjreedy@gpshead

[8]ページ先頭

©2009-2025 Movatter.jp