Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3cfb2cd6
Commit
3cfb2cd6
authored
Jan 02, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #16541: tk_setPalette() now works with keyword arguments.
Added a test for tk_setPalette().
parents
a821f82f
4cf4f3a7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
1 deletion
+48
-1
Lib/tkinter/__init__.py
Lib/tkinter/__init__.py
+1
-1
Lib/tkinter/test/test_tkinter/test_misc.py
Lib/tkinter/test/test_tkinter/test_misc.py
+45
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tkinter/__init__.py
View file @
3cfb2cd6
...
...
@@ -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
...
...
Lib/tkinter/test/test_tkinter/test_misc.py
0 → 100644
View file @
3cfb2cd6
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
)
Misc/NEWS
View file @
3cfb2cd6
...
...
@@ -124,6 +124,8 @@ Core and Builtins
Library
-------
- Issue #16541: tk_setPalette() now works with keyword arguments.
- Issue #16819: IDLE method completion now correctly works for bytes literals.
- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment