summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1997-01-10 15:13:12 (GMT)
committerFred Drake <fdrake@acm.org>1997-01-10 15:13:12 (GMT)
commit41dc09d10ec7cadfb5a0185461e8cce91182bb20 (patch)
treeb26ea6c61f7c0b933d977742cf72bcfd2a84fb52
parent43a476ac002186c28ceccf36009fffe43ce68b0c (diff)
downloadcpython-41dc09d10ec7cadfb5a0185461e8cce91182bb20.zip
cpython-41dc09d10ec7cadfb5a0185461e8cce91182bb20.tar.gz
cpython-41dc09d10ec7cadfb5a0185461e8cce91182bb20.tar.bz2
(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).
-rw-r--r--Lib/lib-tk/Tkinter.py5
-rwxr-xr-xLib/tkinter/Tkinter.py5
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)