GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-43457: Tkinter: fix design flaws in wm_attributes() by serhiy-storchaka · Pull Request #111404 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Oct 27, 2023 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • 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.
  • Issue: wm_attributes doesn't take keyword arguments #43457

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
pythongh-43457: Tkinter: fix design flaws in wm_attributes()
6cbe488
* 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.
@serhiy-storchaka serhiy-storchaka added the topic-tkinter label Oct 27, 2023
@serhiy-storchaka
serhiy-storchaka requested a review from terryjreedy October 27, 2023 16:30
@bedevere-app bedevere-app Bot mentioned this pull request Oct 27, 2023
wm_attributes doesn't take keyword arguments #43457
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 27, 2023
@terryjreedy

terryjreedy commented Oct 28, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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 issue comment 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 of PEP 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)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@terryjreedy terryjreedy closed this Oct 28, 2023
@terryjreedy terryjreedy reopened this Oct 28, 2023
@serhiy-storchaka serhiy-storchaka mentioned this pull request Oct 28, 2023
Requests for the breakning change in the Tkinter method wm_attributes() python/steering-council#211
Closed
serhiy-storchaka added 2 commits November 14, 2023 11:48
@serhiy-storchaka
Merge branch 'main' into tkinter-wm_attributes
d4b41f6
@serhiy-storchaka
Add optional return_python_dict argument.
4852ecd
@serhiy-storchaka

serhiy-storchaka commented Nov 14, 2023

Copy link
Copy Markdown
Member Author

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

@terryjreedy, please make yet one look at it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka added 3 commits February 5, 2024 13:42
@serhiy-storchaka
Merge branch 'main' into tkinter-wm_attributes
2d8d313
@serhiy-storchaka
Do not preserve a weird behavior when wantobjects was set to 0.
49c5cbb
@serhiy-storchaka
Polish docs.
5b91636
@serhiy-storchaka
serhiy-storchaka merged commit b4ba0f7 into python:main Feb 5, 2024
@bedevere-app bedevere-app Bot removed the awaiting core review label Feb 5, 2024
@serhiy-storchaka
serhiy-storchaka deleted the tkinter-wm_attributes branch February 5, 2024 16:25
@terryjreedy

terryjreedy commented Feb 5, 2024

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gpshead
gpshead reviewed Feb 5, 2024
View reviewed changes

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

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 for doing this!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
@serhiy-storchaka @fsc-eriker
pythongh-43457: Tkinter: fix design flaws in wm_attributes() (pythonG…
902d5db
…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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gpshead gpshead gpshead left review comments
@terryjreedy terryjreedy Awaiting requested review from terryjreedy

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic-tkinter

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@serhiy-storchaka @terryjreedy @gpshead
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.