Skip to content

Add **kw to tkinter.Misc.after and tkinter.Misc.after_idle #126899

@Xiaokang2022

Description

@Xiaokang2022

Feature or enhancement

Proposal:

Add the argument **kw to the method after so that the keyword argument can passed to func Conveniently.

The current function definition of the after is as follows:

def after(self, ms, func=None, *args): ...

If we have the argument **kw, we can do this:

import tkinter

root = tkinter.Tk()
root.after(1000, root.configure, bg="red")
root.mainloop()

Otherwise, we may need something like this:

import tkinter

root = tkinter.Tk()
root.after(1000, lambda: root.configure(bg="red"))
root.mainloop()

Obviously, the lambda here looks a bit redundant.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions