mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
added ability to set hilightthickness
This commit is contained in:
parent
9dd16b3443
commit
c034b47ef3
1 changed files with 9 additions and 3 deletions
|
@ -1,22 +1,28 @@
|
||||||
##---------------------------------------------------------------------------##
|
##---------------------------------------------------------------------------##
|
||||||
##
|
##
|
||||||
## idle - tkinter OptionMenu widget modified to allow dynamic
|
## idle - modified OptionMenu widget
|
||||||
## reconfiguration of menu.
|
|
||||||
## elguavas
|
## elguavas
|
||||||
##
|
##
|
||||||
##---------------------------------------------------------------------------##
|
##---------------------------------------------------------------------------##
|
||||||
"""
|
"""
|
||||||
OptionMenu widget modified to allow dynamic menu reconfiguration
|
OptionMenu widget modified to allow dynamic menu reconfiguration
|
||||||
|
and setting of highlightthickness
|
||||||
"""
|
"""
|
||||||
from Tkinter import OptionMenu
|
from Tkinter import OptionMenu
|
||||||
from Tkinter import _setit
|
from Tkinter import _setit
|
||||||
|
import copy
|
||||||
|
|
||||||
class DynOptionMenu(OptionMenu):
|
class DynOptionMenu(OptionMenu):
|
||||||
"""
|
"""
|
||||||
OptionMenu widget that allows dynamic menu reconfiguration
|
unlike OptionMenu, our kwargs can include highlightthickness
|
||||||
"""
|
"""
|
||||||
def __init__(self, master, variable, value, *values, **kwargs):
|
def __init__(self, master, variable, value, *values, **kwargs):
|
||||||
|
#get a copy of kwargs before OptionMenu.__init__ munges them
|
||||||
|
kwargsCopy=copy.copy(kwargs)
|
||||||
|
if 'highlightthickness' in kwargs.keys():
|
||||||
|
del(kwargs['highlightthickness'])
|
||||||
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
|
OptionMenu.__init__(self, master, variable, value, *values, **kwargs)
|
||||||
|
self.config(highlightthickness=kwargsCopy.get('highlightthickness'))
|
||||||
#self.menu=self['menu']
|
#self.menu=self['menu']
|
||||||
self.variable=variable
|
self.variable=variable
|
||||||
self.command=kwargs.get('command')
|
self.command=kwargs.get('command')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue