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 — bpo-32839: Add after_info to tkinter by csabella · Pull Request #5664 · python/cpython

bpo-32839: Add after_info to tkinter #5664

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.

Sign up for GitHub

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

Merged
serhiy-storchaka merged 11 commits into python:main from csabella:bpo32839
Apr 26, 2024

Uh oh!

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

Merged

bpo-32839: Add after_info to tkinter #5664

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
f3598e1
Add after_info to tkinter
csabella Feb 13, 2018
51bfe2b
Changes per review.
csabella Feb 13, 2018
57806b7
Merge branch 'master' into bpo32839
terryjreedy Dec 31, 2019
ff9e774
Cancel specific timer in test
csabella Jan 26, 2020
5b33773
Update Lib/tkinter/__init__.py
serhiy-storchaka Apr 25, 2024
0c9d622
Merge commit 'c1fb12e5afa09aca3134a9bc0116c31dbcccc5e9~' into bpo32839
serhiy-storchaka Apr 25, 2024
26e2249
Merge commit 'c1fb12e5afa09aca3134a9bc0116c31dbcccc5e9' into bpo32839
serhiy-storchaka Apr 25, 2024
8899add
Merge branch 'main' into bpo32839
serhiy-storchaka Apr 25, 2024
94a71a4
Update NEWS.
serhiy-storchaka Apr 25, 2024
02df0b0
Revert "Update Lib/tkinter/__init__.py"
serhiy-storchaka Apr 25, 2024
e83e68d
Silence the linter for What's New.
serhiy-storchaka Apr 25, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view

There are no files selected for viewing

3 changes: 3 additions & 0 deletions 3 Doc/whatsnew/3.13.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,9 @@ tkinter
:class:`tkinter.ttk.Style`.
(Contributed by Serhiy Storchaka in :gh:`68166`.)

* Add the :meth:`!after_info` method for Tkinter widgets.
(Contributed by Cheryl Sabella in :gh:`77020`.)

traceback
---------

Expand Down
40 changes: 40 additions & 0 deletions 40 Lib/test/test_tkinter/test_misc.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,46 @@ def callback():
with self.assertRaises(tkinter.TclError):
root.tk.call('after', 'info', idle1)

def test_after_info(self):
root = self.root

# No events.
self.assertEqual(root.after_info(), ())

# Add timer.
timer = root.after(1, lambda: 'break')

# With no parameter, it returns a tuple of the event handler ids.
self.assertEqual(root.after_info(), (timer, ))
root.after_cancel(timer)

timer1 = root.after(5000, lambda: 'break')
timer2 = root.after(5000, lambda: 'break')
idle1 = root.after_idle(lambda: 'break')
# Only contains new events and not 'timer'.
self.assertEqual(root.after_info(), (idle1, timer2, timer1))

# With a parameter returns a tuple of (script, type).
timer1_info = root.after_info(timer1)
self.assertEqual(len(timer1_info), 2)
self.assertEqual(timer1_info[1], 'timer')
idle1_info = root.after_info(idle1)
self.assertEqual(len(idle1_info), 2)
self.assertEqual(idle1_info[1], 'idle')

root.after_cancel(timer1)
with self.assertRaises(tkinter.TclError):
root.after_info(timer1)
root.after_cancel(timer2)
with self.assertRaises(tkinter.TclError):
root.after_info(timer2)
root.after_cancel(idle1)
with self.assertRaises(tkinter.TclError):
root.after_info(idle1)

# No events.
self.assertEqual(root.after_info(), ())

def test_clipboard(self):
root = self.root
root.clipboard_clear()
Expand Down
15 changes: 15 additions & 0 deletions 15 Lib/tkinter/__init__.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,21 @@ def after_cancel(self, id):
pass
self.tk.call('after', 'cancel', id)

def after_info(self, id=None):
"""Return information about existing event handlers.

With no argument, return a tuple of the identifiers for all existing
event handlers created by the after and after_idle commands for this
interpreter. If id is supplied, it specifies an existing handler; id
must have been the return value from some previous call to after or
after_idle and it must not have triggered yet or been canceled. If the
id doesn't exist, a TclError is raised. Otherwise, the return value is
a tuple containing (script, type) where script is a reference to the
function to be called by the event handler and type is either 'idle'
or 'timer' to indicate what kind of event handler it is.
"""
return self.tk.splitlist(self.tk.call('after', 'info', id))
Comment thread
terryjreedy marked this conversation as resolved.
Resolved

Uh oh!

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

Comment thread
serhiy-storchaka marked this conversation as resolved.
Resolved

Uh oh!

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


def bell(self, displayof=0):
"""Ring a display's bell."""
self.tk.call(('bell',) + self._displayof(displayof))
Expand Down
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Library/2018-02-13-10-02-54.bpo-32839.McbVz3.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the :meth:`after_info` method for Tkinter widgets.
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.