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-66410: Do not stringify arguments of Tkinter callback by serhiy-storchaka · Pull Request #98592 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Oct 24, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

  • Issue: Tkinter: Don't stringify callback arguments #66410

Sorry, something went wrong.

Uh oh!

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

All reactions
@serhiy-storchaka
pythongh-66410: Do not stringify arguments of Tkinter callback
d269e22
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 linked an issue Oct 24, 2022 that may be closed by this pull request
Tkinter: Don't stringify callback arguments #66410
Closed
@serhiy-storchaka serhiy-storchaka mentioned this pull request Oct 24, 2022
Tkinter: Don't stringify callback arguments #66410
Closed
@serhiy-storchaka
Fix IDLE.
f5c6e4a
@serhiy-storchaka
serhiy-storchaka requested a review from terryjreedy as a code owner October 24, 2022 13:07
@serhiy-storchaka
Try to fix events on Windows.
5612706
@serhiy-storchaka
serhiy-storchaka marked this pull request as draft October 24, 2022 15:13
@terryjreedy

terryjreedy commented Oct 24, 2022

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka

serhiy-storchaka commented Oct 28, 2022

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka
Merge branch 'main' into tkinter-obj-cmd
24165e2
@serhiy-storchaka
serhiy-storchaka marked this pull request as ready for review May 7, 2024 11:15
@bedevere-app bedevere-app Bot added the awaiting core review label May 7, 2024
@serhiy-storchaka
Merge branch 'main' into tkinter-obj-cmd
d10ed25
@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
@bedevere-app bedevere-app Bot removed the awaiting core review label May 7, 2024
@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
@serhiy-storchaka @SonicField
pythongh-66410: Do not stringify arguments of Tkinter callback (pytho…
9ee55ed
…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 serhiy-storchaka mentioned this pull request May 8, 2024
Tkinter getint(), getboolean() argument must be str, not tuple #118760
Closed
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request May 8, 2024
@serhiy-storchaka
pythongh-118760: Restore the default value of tkiter.wantobjects to 1
a65789b
It was set to 2 in 65f5e58 (pythonGH-98592).
@serhiy-storchaka serhiy-storchaka mentioned this pull request May 8, 2024
gh-118760: Restore the default value of tkinter.wantobjects to 1 #118784
Merged
@serhiy-storchaka serhiy-storchaka mentioned this pull request May 16, 2024
Add Tkinter tests for different events. #118778
Merged
serhiy-storchaka added a commit that referenced this pull request May 20, 2024
@serhiy-storchaka
gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-…
e188527
…118784)

It was set to 2 in 65f5e58 (GH-98592).
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 20, 2024
@serhiy-storchaka @miss-islington
pythongh-118760: Restore the default value of tkinter.wantobjects to 1 (
1b00598
pythonGH-118784)

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

Co-authored-by: Serhiy Storchaka <[email protected]>
@miss-islington miss-islington mentioned this pull request May 20, 2024
[3.13] gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784) #119251
Merged
serhiy-storchaka added a commit that referenced this pull request May 20, 2024
@miss-islington @serhiy-storchaka
[3.13] gh-118760: Restore the default value of tkinter.wantobjects to…
b4462aa
… 1 (GH-118784) (GH-119251)

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

Co-authored-by: Serhiy Storchaka <[email protected]>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
@serhiy-storchaka @estyxx
pythongh-118760: Restore the default value of tkinter.wantobjects to 1 (
6b5ad2c
pythonGH-118784)

It was set to 2 in 65f5e58 (pythonGH-98592).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@terryjreedy terryjreedy Awaiting requested review from terryjreedy terryjreedy is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Tkinter: Don't stringify callback arguments

Uh oh!

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

2 participants

@serhiy-storchaka @terryjreedy
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.