You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add missing symbolic constants to tkinter.constants #159301
tkinter.constants provides symbolic constants for the enumerated keywords of the Tk API, such as END, RAISED or CASCADE, and they are re-exported from tkinter.
It is essentially complete for the classic widgets as they were in Tk 8.0, but it was never extended for keywords added later, and it contains no ttk keywords at all.
Tk defines its enumerated option values in string tables (const char *const ...Strings[]) used with Tcl_GetIndexFromObj or as TK_OPTION_STRING_TABLE option specs.
Of the 174 keyword slots in these sets, tkinter.constants covers 121, so 47 distinct keywords have no constant.
All other names are available in all supported Tk versions, starting from 8.5.
The remaining missing keywords are not worth a constant: the themed user1-user6 states are user-defined placeholders, and the -size values of ttk.Toggleswitch are the digits 1, 2 and 3, which would clash confusingly with the integer TRUE = 1.
This came up in #158328, where adding the symbolic color names was rejected.
Unlike color names, these are small closed sets fixed by Tk, which is what tkinter.constants is for.
Activity