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
568b223c
Commit
568b223c
authored
Mar 09, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #26177: Fixed the keys() method for Canvas and Scrollbar widgets.
parents
1a18fec3
6897de31
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
138 deletions
+183
-138
Lib/tkinter/__init__.py
Lib/tkinter/__init__.py
+3
-2
Lib/tkinter/test/test_tkinter/test_geometry_managers.py
Lib/tkinter/test/test_tkinter/test_geometry_managers.py
+6
-0
Lib/tkinter/test/test_tkinter/test_widgets.py
Lib/tkinter/test/test_tkinter/test_widgets.py
+11
-2
Lib/tkinter/test/test_ttk/test_widgets.py
Lib/tkinter/test/test_ttk/test_widgets.py
+134
-134
Lib/tkinter/test/widget_tests.py
Lib/tkinter/test/widget_tests.py
+27
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tkinter/__init__.py
View file @
568b223c
...
...
@@ -1336,8 +1336,9 @@ class Misc:
self.configure({key: value})
def keys(self):
"""Return a list of all resource names of this widget."""
return [x[0][1:] for x in
self.tk.splitlist(self.tk.call(self._w, 'configure'))]
splitlist = self.tk.splitlist
return [splitlist(x)[0][1:] for x in
splitlist(self.tk.call(self._w, 'configure'))]
def __str__(self):
"""Return the window path name of this widget."""
return self._w
...
...
Lib/tkinter/test/test_tkinter/test_geometry_managers.py
View file @
568b223c
...
...
@@ -12,6 +12,8 @@ requires('gui')
class
PackTest
(
AbstractWidgetTest
,
unittest
.
TestCase
):
test_keys
=
None
def
create2
(
self
):
pack
=
tkinter
.
Toplevel
(
self
.
root
,
name
=
'pack'
)
pack
.
wm_geometry
(
'300x200+0+0'
)
...
...
@@ -276,6 +278,8 @@ class PackTest(AbstractWidgetTest, unittest.TestCase):
class
PlaceTest
(
AbstractWidgetTest
,
unittest
.
TestCase
):
test_keys
=
None
def
create2
(
self
):
t
=
tkinter
.
Toplevel
(
self
.
root
,
width
=
300
,
height
=
200
,
bd
=
0
)
t
.
wm_geometry
(
'300x200+0+0'
)
...
...
@@ -478,6 +482,8 @@ class PlaceTest(AbstractWidgetTest, unittest.TestCase):
class
GridTest
(
AbstractWidgetTest
,
unittest
.
TestCase
):
test_keys
=
None
def
tearDown
(
self
):
cols
,
rows
=
self
.
root
.
grid_size
()
for
i
in
range
(
cols
+
1
):
...
...
Lib/tkinter/test/test_tkinter/test_widgets.py
View file @
568b223c
...
...
@@ -103,7 +103,7 @@ class FrameTest(AbstractToplevelTest, unittest.TestCase):
'background'
,
'borderwidth'
,
'class'
,
'colormap'
,
'container'
,
'cursor'
,
'height'
,
'highlightbackground'
,
'highlightcolor'
,
'highlightthickness'
,
'relief'
,
'takefocus'
,
'visual'
,
'width'
,
'
padx'
,
'pady'
,
'
relief'
,
'takefocus'
,
'visual'
,
'width'
,
)
def
create
(
self
,
**
kwargs
):
...
...
@@ -637,7 +637,7 @@ class CanvasTest(AbstractWidgetTest, unittest.TestCase):
'highlightbackground'
,
'highlightcolor'
,
'highlightthickness'
,
'insertbackground'
,
'insertborderwidth'
,
'insertofftime'
,
'insertontime'
,
'insertwidth'
,
'relief'
,
'scrollregion'
,
'
offset'
,
'
relief'
,
'scrollregion'
,
'selectbackground'
,
'selectborderwidth'
,
'selectforeground'
,
'state'
,
'takefocus'
,
'xscrollcommand'
,
'xscrollincrement'
,
...
...
@@ -659,6 +659,15 @@ class CanvasTest(AbstractWidgetTest, unittest.TestCase):
widget
=
self
.
create
()
self
.
checkBooleanParam
(
widget
,
'confine'
)
def
test_offset
(
self
):
widget
=
self
.
create
()
self
.
assertEqual
(
widget
[
'offset'
],
'0,0'
)
self
.
checkParams
(
widget
,
'offset'
,
'n'
,
'ne'
,
'e'
,
'se'
,
's'
,
'sw'
,
'w'
,
'nw'
,
'center'
)
self
.
checkParam
(
widget
,
'offset'
,
'10,20'
)
self
.
checkParam
(
widget
,
'offset'
,
'#5,6'
)
self
.
checkInvalidParam
(
widget
,
'offset'
,
'spam'
)
def
test_scrollregion
(
self
):
widget
=
self
.
create
()
self
.
checkParam
(
widget
,
'scrollregion'
,
'0 0 200 150'
)
...
...
Lib/tkinter/test/test_ttk/test_widgets.py
View file @
568b223c
This diff is collapsed.
Click to expand it.
Lib/tkinter/test/widget_tests.py
View file @
568b223c
...
...
@@ -206,6 +206,33 @@ class AbstractWidgetTest(AbstractTkTest):
break
def
test_keys
(
self
):
widget
=
self
.
create
()
keys
=
widget
.
keys
()
# XXX
if
not
isinstance
(
widget
,
Scale
):
self
.
assertEqual
(
sorted
(
keys
),
sorted
(
widget
.
configure
()))
for
k
in
keys
:
widget
[
k
]
# Test if OPTIONS contains all keys
if
test
.
support
.
verbose
:
aliases
=
{
'bd'
:
'borderwidth'
,
'bg'
:
'background'
,
'fg'
:
'foreground'
,
'invcmd'
:
'invalidcommand'
,
'vcmd'
:
'validatecommand'
,
}
keys
=
set
(
keys
)
expected
=
set
(
self
.
OPTIONS
)
for
k
in
sorted
(
keys
-
expected
):
if
not
(
k
in
aliases
and
aliases
[
k
]
in
keys
and
aliases
[
k
]
in
expected
):
print
(
'%s.OPTIONS doesn
\
'
t contain "%s"'
%
(
self
.
__class__
.
__name__
,
k
))
class
StandardOptionsTests
:
STANDARD_OPTIONS
=
(
'activebackground'
,
'activeborderwidth'
,
'activeforeground'
,
'anchor'
,
...
...
Misc/NEWS
View file @
568b223c
...
...
@@ -201,6 +201,8 @@ Core and Builtins
Library
-------
-
Issue
#
26177
:
Fixed
the
keys
()
method
for
Canvas
and
Scrollbar
widgets
.
-
Issue
#
21042
:
Make
ctypes
.
util
.
find_library
()
return
the
full
path
on
Linux
,
similar
to
other
platforms
.
Patch
by
Tam
á
s
Bence
Gedai
.
...
...
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