-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
tkinter after_cancel does not behave correctly when called with id=None #77038
Comments
This was discovered while working on bpo-32839. An old comment added for bpo-763637 resulted in further research and it was determined that the comment: ! data = self.tk.call('after', 'info', id) wasn't correct. The underlying difference is that the call to 'after info' returns different results depending on the way it's called. If it's called with an 'id', it will return a tuple of (script, type) if the id is valid or a TclError if the id isn't valid. However, if id is None, then 'after info' returns a tuple of all the event ids for the widget. In the case of the original bug in bpo-763637, the reported message shows the return value of Serhiy mentions on bpo-32839 that the current code also deletes the script for the first event if after_cancel is called with None. |
I can open a PR for this, but thought it might be best to discuss it first as far as what should happen with None.
Tcl allows the after_cancel call to be an id or script(s), but they don't have functionality that would cancel everything (unless all the FWIW, if no parameters are sent, this is the Tcl code:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "id|command");
return TCL_ERROR;
} |
I prefer the option 1. Even if calling after_cancel(None) would make sense, currently it silently does wrong things, and it is more errorproof to make it raising an exception. |
I have noticed that there are no tests for after() and after_cancel(). Maybe first write tests for them and later add a test for this specific issue to them? |
I had also noticed that the Thanks! |
It's up to you. |
I've added the tests for |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: