(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:
Fred Drake 1997-01-10 15:13:12 +00:00
parent 43a476ac00
commit 41dc09d10e
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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)