This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author patthoyts
Recipients patthoyts
Date 2020-11-12.00:27:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605140874.05.0.0614253934034.issue42328@roundup.psfhosted.org>
In-reply-to
Content
When cloning a ttk style it is useful to copy an existing style and make changes. We can copy the configuration and layout using:

    style.layout('Custom.TEntry', **style.layout('TEntry'))
    style.configure('Custom.TEntry', **style.configure('TEntry))

However, doing this with style.map can result in an exception. An example of this occurs for any style that has a defined default state in the map eg the TNotebook.Tab in the clam theme:

    >>> style.map('TNotebook.Tab','background')
    [('selected', '#dcdad5'), ('#bab5ab',)]

However, calling Tk directly:

    >>> style.tk.call(style._name,"map","TNotebook.Tab","-background")
    (<StateSpec object: 'selected'>, '#dcdad5', <StateSpec object: ''>, '#bab5ab')

The second pair is defining the default state ('') to use color #bab5ab but this is being mangled by the code that converts this into pythons response.

The culprit is ttk._list_from_statespec which treats the statespec with the empty string as None and drops it and then returns the value in place of the state and then puts in an empty value.
History
Date User Action Args
2020-11-12 00:27:54patthoytssetrecipients: + patthoyts
2020-11-12 00:27:54patthoytssetmessageid: <1605140874.05.0.0614253934034.issue42328@roundup.psfhosted.org>
2020-11-12 00:27:54patthoytslinkissue42328 messages
2020-11-12 00:27:53patthoytscreate