8000 Refactor DynOptionMenu's initializer to no longer copy the kwargs dict · python/cpython@58e5a11 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58e5a11

Browse files
author
Joe S. Boyle
committed
Refactor DynOptionMenu's initializer to no longer copy the kwargs dict
1 parent 409f533 commit 58e5a11

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Lib/idlelib/dynoption.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@
22
OptionMenu widget modified to allow dynamic menu reconfiguration
33
and setting of highlightthickness
44
"""
5-
import copy
6-
75
from tkinter import OptionMenu, _setit, StringVar, Button
86

97
class DynOptionMenu(OptionMenu):
108
"""
119
unlike OptionMenu, our kwargs can include highlightthickness
1210
"""
1311
def __init__(self, master, variable, value, *values, **kwargs):
14-
# TODO copy value instead of whole dict
15-
kwargsCopy=copy.copy(kwargs)
16-
if 'highlightthickness' in list(kwargs.keys()):
17-
del(kwargs['highlightthickness'])
12+
highlightthickness = kwargs.pop('highlightthickness', None)
1813
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
19-
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
20-
#self.menu=self['menu']
21-
self.variable=variable
22-
self.command=kwargs.get('command')
14+
self.config(highlightthickness=highlightthickness)
15+
self.variable = variable
16+
self.command = kwargs.get('command')
2317

2418
def SetMenu(self,valueList,value=None):
2519
"""

0 commit comments

Comments
 (0)
0