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.

classification
Title: Tkinter theme settings object schema is missing
Type: Stage: resolved
Components: Tkinter Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: WHK102, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2021-04-02 20:30 by WHK102, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg390097 - (view) Author: WHK (WHK102) Date: 2021-04-02 20:30
By example

style = ttk.Style()
style.theme_settings('default', settings={
    '.': []
})

Tkinter settings schema or typed data is missing. By example:

_tkinter.TclError: Invalid state name d

This error message does not provide the missing parameter information, by example expected: "Tupe is required in .::Map background, not dict"
msg390671 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-04-09 22:06
You code as posted is buggy.  'settings' maps styles to dicts with possible keys ‘configure’, ‘map’, ‘layout’ and ‘element create’.  See
https://docs.python.org/3/library/tkinter.ttk.html#tkinter.ttk.Style.theme_create

I presume '.' refers to all styles, but [] is not a dict, let alone one with the allowed keys and values.  Thus for me, in 3.8.9 and 3.10.0 on Win10,

from tkinter import ttk
style = ttk.Style()
style.theme_settings('default', {'.': []})

results in a traceback ending with the true statement
AttributeError: 'list' object has no attribute 'get'

Your code does not match the error you reported, as the AttributeError is raised in tkinter.ttk._script_from_settings before calling tk.  If you posted the wrong code, and you actually got the error you reported with other code, recheck to make sure it matches the doc and if you still get an error, repost with OS and full Python version (x.y.z).  If you used an earlier version of 3.8, please try with the latest release or a later version, as there might have been a tkinter bug fix.
History
Date User Action Args
2022-04-11 14:59:43adminsetgithub: 87874
2021-04-09 22:06:16terry.reedysetstatus: open -> closed

nosy: + terry.reedy, serhiy.storchaka
messages: + msg390671

resolution: not a bug
stage: resolved
2021-04-02 20:30:08WHK102create