mirror of
https://github.com/python/cpython.git
synced 2024-11-28 20:33:54 +08: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
@ -1219,7 +1219,10 @@ class Frame(Widget):
|
||||
def __init__(self, master=None, cnf={}, **kw):
|
||||
cnf = _cnfmerge((cnf, kw))
|
||||
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'])
|
||||
del cnf['class']
|
||||
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
||||
|
@ -1219,7 +1219,10 @@ class Frame(Widget):
|
||||
def __init__(self, master=None, cnf={}, **kw):
|
||||
cnf = _cnfmerge((cnf, kw))
|
||||
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'])
|
||||
del cnf['class']
|
||||
Widget.__init__(self, master, 'frame', cnf, {}, extra)
|
||||
|
Loading…
Reference in New Issue
Block a user