Skip to content
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

gh-66410: Do not stringify arguments of Tkinter callback #98592

Merged
merged 5 commits into from
May 7, 2024

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Oct 24, 2022

Callbacks registered in the tkinter module now take arguments as various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1 before creating the Tk object or call the wantobject() method of the Tk object with argument 1.
Calling it with argument 2 restores the current default behavior.

Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
@serhiy-storchaka serhiy-storchaka marked this pull request as draft October 24, 2022 15:13
@terryjreedy
Copy link
Member

I did a first read. I think the news/new messages could be clearer, but need to think more about a suggestion.

@serhiy-storchaka
Copy link
Member Author

The IDLE tests exposed two failures. One is specific to IDLE, its clever use of redefining the Tcl command corresponded to a widget. It is not typical use of Tkinter and I do not think that many other code will have such issue. Other one is more generic, related to creating the Event objects, it would affect more code. We need to add special Event-related code in Tkinter tests and check what more can be affected by this change. This is why this PR is still a draft.

@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review May 7, 2024 11:15
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) May 7, 2024 11:44
@serhiy-storchaka serhiy-storchaka merged commit 65f5e58 into python:main May 7, 2024
36 checks passed
@serhiy-storchaka serhiy-storchaka deleted the tkinter-obj-cmd branch May 7, 2024 12:10
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
…nGH-98592)

Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request May 8, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
pythonGH-118784)

It was set to 2 in 65f5e58 (pythonGH-98592).
(cherry picked from commit e188527)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request May 20, 2024
… 1 (GH-118784) (GH-119251)

It was set to 2 in 65f5e58 (GH-98592).
(cherry picked from commit e188527)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tkinter: Don't stringify callback arguments
2 participants