Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE: Simplify DynOptionsMenu __init__code #101371

Merged
merged 4 commits into from
Feb 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions Lib/idlelib/dynoption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@
OptionMenu widget modified to allow dynamic menu reconfiguration
and setting of highlightthickness
"""
import copy

from tkinter import OptionMenu, _setit, StringVar, Button

class DynOptionMenu(OptionMenu):
"""
unlike OptionMenu, our kwargs can include highlightthickness
"""
def __init__(self, master, variable, value, *values, **kwargs):
# TODO copy value instead of whole dict
kwargsCopy=copy.copy(kwargs)
if 'highlightthickness' in list(kwargs.keys()):
del(kwargs['highlightthickness'])
highlightthickness = kwargs.pop('highlightthickness', None)
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
#self.menu=self['menu']
self.variable=variable
self.command=kwargs.get('command')
self.config(highlightthickness=highlightthickness)
JosephSBoyle marked this conversation as resolved.
Show resolved Hide resolved
self.variable = variable
self.command = kwargs.get('command')

def SetMenu(self,valueList,value=None):
"""
Expand Down