diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-02 08:40:36 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-02 08:40:36 (GMT) |
commit | 08f455652444e7debd746ff42efc72cb76d4ec7b (patch) | |
tree | 879e167103f25f2d336ed753c29cc720db6cbe75 /Lib/tkinter | |
parent | 2869b00d7958177b90debad8d48bb637b84cc468 (diff) | |
parent | cc6b514a72f28373a2724e87ee1472c610895d1c (diff) | |
download | cpython-08f455652444e7debd746ff42efc72cb76d4ec7b.zip cpython-08f455652444e7debd746ff42efc72cb76d4ec7b.tar.gz cpython-08f455652444e7debd746ff42efc72cb76d4ec7b.tar.bz2 |
Merge heads
Diffstat (limited to 'Lib/tkinter')
-rw-r--r-- | Lib/tkinter/__init__.py | 2 | ||||
-rw-r--r-- | Lib/tkinter/test/test_tkinter/test_misc.py | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 0addc18..3956e85 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -391,7 +391,7 @@ class Misc: background, highlightColor, selectForeground, disabledForeground, insertBackground, troughColor.""" self.tk.call(('tk_setPalette',) - + _flatten(args) + _flatten(kw.items())) + + _flatten(args) + _flatten(list(kw.items()))) def tk_menuBar(self, *args): """Do not use. Needed in Tk 3.6 and earlier.""" pass # obsolete since Tk 4.0 diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py new file mode 100644 index 0000000..d325b31 --- /dev/null +++ b/Lib/tkinter/test/test_tkinter/test_misc.py @@ -0,0 +1,45 @@ +import unittest +import tkinter +from tkinter import ttk +from test import support + +support.requires('gui') + +class MiscTest(unittest.TestCase): + + def setUp(self): + self.root = ttk.setup_master() + + def test_tk_setPalette(self): + root = self.root + root.tk_setPalette('black') + self.assertEqual(root['background'], 'black') + root.tk_setPalette('white') + self.assertEqual(root['background'], 'white') + self.assertRaisesRegex(tkinter.TclError, + '^unknown color name "spam"$', + root.tk_setPalette, 'spam') + + root.tk_setPalette(background='black') + self.assertEqual(root['background'], 'black') + root.tk_setPalette(background='blue', highlightColor='yellow') + self.assertEqual(root['background'], 'blue') + self.assertEqual(root['highlightcolor'], 'yellow') + root.tk_setPalette(background='yellow', highlightColor='blue') + self.assertEqual(root['background'], 'yellow') + self.assertEqual(root['highlightcolor'], 'blue') + self.assertRaisesRegex(tkinter.TclError, + '^unknown color name "spam"$', + root.tk_setPalette, background='spam') + self.assertRaisesRegex(tkinter.TclError, + '^must specify a background color$', + root.tk_setPalette, spam='white') + self.assertRaisesRegex(tkinter.TclError, + '^must specify a background color$', + root.tk_setPalette, highlightColor='blue') + + +tests_gui = (MiscTest, ) + +if __name__ == "__main__": + support.run_unittest(*tests_gui) |