From: Fred Drake Date: Fri, 10 Jan 1997 15:13:12 +0000 (+0000) Subject: (Tkinter.py): Add support for Frame(w, class_="classname") as an alternative X-Git-Tag: v1.5a1~554 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41dc09d10ec7cadfb5a0185461e8cce91182bb20;p=python (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). --- diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 286a55719f..9fb1d025eb 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -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) diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index 286a55719f..9fb1d025eb 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -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)