Skip to content

Commit 58d2f4a

Browse files
gh-72880: Accept FontChooser options as keyword arguments
Take the configuration options via **options and forward them to configure(), like SysTrayIcon, instead of enumerating each option in the constructor signature. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b1bba0e commit 58d2f4a

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

Doc/library/tkinter.fontchooser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The dialog also generates two virtual events on the parent window
4040
On some platforms the *font* option is not updated to the user's
4141
choice.
4242

43-
.. class:: FontChooser(master=None, *, parent=None, title=None, font=None, command=None)
43+
.. class:: FontChooser(master=None, **options)
4444

4545
The class implementing the font selection dialog.
4646

Lib/tkinter/fontchooser.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,13 @@ class FontChooser:
3636
to the user's choice.
3737
"""
3838

39-
def __init__(self, master=None, *, parent=None, title=None, font=None,
40-
command=None):
39+
def __init__(self, master=None, **options):
4140
if master is None:
42-
master = parent
41+
master = options.get('parent')
4342
if master is None:
4443
master = tkinter._get_default_root('create a font chooser')
4544
self.master = master
4645
self._command_name = None
47-
options = {}
48-
if parent is not None:
49-
options['parent'] = parent
50-
if title is not None:
51-
options['title'] = title
52-
if font is not None:
53-
options['font'] = font
54-
if command is not None:
55-
options['command'] = command
5646
if options:
5747
self.configure(options)
5848

0 commit comments

Comments
 (0)