mirror of
https://github.com/python/cpython.git
synced 2025-09-11 19:27:07 +00:00
(Tkinter.py): Add support for Frame(w, class_="classname") as an alternative
to Frame(w, cnf={"class": "classname"}). I think this is the only widget other than Toplevel that needs to be concerned about setting the widget's class (-class must be the first option on the Tcl widget creation command).
This commit is contained in:
parent
43a476ac00
commit
41dc09d10e
2 changed files with 8 additions and 2 deletions
|
@ -1219,7 +1219,10 @@ class Frame(Widget):
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
cnf = _cnfmerge((cnf, kw))
|
cnf = _cnfmerge((cnf, kw))
|
||||||
extra = ()
|
extra = ()
|
||||||
if cnf.has_key('class'):
|
if cnf.has_key('class_'):
|
||||||
|
extra = ('-class', cnf['class_'])
|
||||||
|
del cnf['class_']
|
||||||
|
elif cnf.has_key('class'):
|
||||||
extra = ('-class', cnf['class'])
|
extra = ('-class', cnf['class'])
|
||||||
del cnf['class']
|
del cnf['class']
|
||||||
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
||||||
|
|
|
@ -1219,7 +1219,10 @@ class Frame(Widget):
|
||||||
def __init__(self, master=None, cnf={}, **kw):
|
def __init__(self, master=None, cnf={}, **kw):
|
||||||
cnf = _cnfmerge((cnf, kw))
|
cnf = _cnfmerge((cnf, kw))
|
||||||
extra = ()
|
extra = ()
|
||||||
if cnf.has_key('class'):
|
if cnf.has_key('class_'):
|
||||||
|
extra = ('-class', cnf['class_'])
|
||||||
|
del cnf['class_']
|
||||||
|
elif cnf.has_key('class'):
|
||||||
extra = ('-class', cnf['class'])
|
extra = ('-class', cnf['class'])
|
||||||
del cnf['class']
|
del cnf['class']
|
||||||
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue