From 41dc09d10ec7cadfb5a0185461e8cce91182bb20 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 10 Jan 1997 15:13:12 +0000 Subject: (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). --- Lib/lib-tk/Tkinter.py | 5 ++++- Lib/tkinter/Tkinter.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 286a557..9fb1d02 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 286a557..9fb1d02 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) -- cgit v0.12