Skip to content

bpo-42328: ttk fix handling of default states in style map #23241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Lib/tkinter/test/test_ttk/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ def test_it(sspec, value, res_value, states):

test_it(('a', 'b', 'c'), MockTclObj('val'), 'val', ('a', 'b', 'c'))

spec = (MockStateSpec('a'), '#fff', MockStateSpec(''), '#ccc')
self.assertEqual(ttk._list_from_statespec(spec),
[('a', '#fff'), ('', '#ccc')])

def test_list_from_layouttuple(self):
tk = MockTkApp()
Expand Down
2 changes: 1 addition & 1 deletion Lib/tkinter/ttk.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _list_from_statespec(stuple):
else: # this is a Tcl object
val = str(val)
if typename == 'StateSpec':
val = val.split()
val = val.split() if val else ''
nval.append(val)

it = iter(nval)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ammend the ttk._list_from_statespec function to correctly return the state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ammend the ttk._list_from_statespec function to correctly return the state
Amend the ttk._list_from_statespec function to correctly return the state

specification for the ttk map when a default state is given.