Skip to content

Adding default value as None for tk.OptionMenu and ttk.OptionMenu positional arguments in order to follow standards and get default non-parameterized widget #130356

@kurawlefaraaz

Description

@kurawlefaraaz

Feature or enhancement

Proposal:

In current implementation of .__init__ of tk.OptionMenu, tkinter raise's error if we use

tk.OptionMenu() # Argument missing error

while other widgets like tk.Button work without arguments

 tk.Button() # No Error

Therefore by making the below change, tkinter can follow its standard among other widget as well as let user get a non-parameterized OptionMenu widget.

Change:

def __init__(self, master, variable, value, *values, **kwargs): #Line 4020 in cpython/Lib/tkinter /__init__.py

To:

def __init__(self, master=None, variable=None, value=None, *values, **kwargs): #Line 4020 in cpython/Lib/tkinter /__init__.py

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