mirror of
https://github.com/python/cpython.git
synced 2025-10-06 07:02:33 +00:00
bpo-32857: Raise error when tkinter after_cancel() is called with None. (GH-5701)
(cherry picked from commit 74382a3f17
)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
This commit is contained in:
parent
0902a2d6b2
commit
a5303dd9c2
3 changed files with 115 additions and 3 deletions
|
@ -739,6 +739,7 @@ class Misc:
|
|||
if not func:
|
||||
# I'd rather use time.sleep(ms*0.001)
|
||||
self.tk.call('after', ms)
|
||||
return None
|
||||
else:
|
||||
def callit():
|
||||
try:
|
||||
|
@ -762,11 +763,13 @@ class Misc:
|
|||
"""Cancel scheduling of function identified with ID.
|
||||
|
||||
Identifier returned by after or after_idle must be
|
||||
given as first parameter."""
|
||||
given as first parameter.
|
||||
"""
|
||||
if not id:
|
||||
raise ValueError('id must be a valid identifier returned from '
|
||||
'after or after_idle')
|
||||
try:
|
||||
data = self.tk.call('after', 'info', id)
|
||||
# In Tk 8.3, splitlist returns: (script, type)
|
||||
# In Tk 8.4, splitlist may return (script, type) or (script,)
|
||||
script = self.tk.splitlist(data)[0]
|
||||
self.deletecommand(script)
|
||||
except TclError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue