Removing Ttk Notebook Tab Dashed Line
On a Windows machine, if I create a theme and use "classic" as parent, the ugly dashed border is also not drawn.
style.theme_create( "Florina", parent="classic", settings={
"TLabel": {"configure": {"background": BACKGROUND }},
"TFrame": {"configure": {"background": BACKGROUND }},
"TNotebook": {
"configure": {"background": BACKGROUND, "tabmargins": [1, 5, 2, 0] }},
"TNotebook.Tab": {
"configure": {"background": DARKBG, "padding": [5, 2] },
"map": {"background": [("selected", BACKGROUND)],
"expand": [("selected", [1, 1, 1, 0])]
} } } )
You can remove this focus mark by altering the sub elements of tab widget. Ttk widgets are decomposed in subelements. The layout of these elements is described through layout
method (or in a layout parameter of theme_create
). Here is a command to remove layout marks (you can apply it directly to Tab, or any other derived theme), the commented part is what lead previously to drawing the focus (retrieved through style.layout("Tab")
)
style.layout("Tab",
[('Notebook.tab', {'sticky': 'nswe', 'children':
[('Notebook.padding', {'side': 'top', 'sticky': 'nswe', 'children':
#[('Notebook.focus', {'side': 'top', 'sticky': 'nswe', 'children':
[('Notebook.label', {'side': 'top', 'sticky': ''})],
#})],
})],
})]
)
A more hacky way could be to alter the color of this focus mark, for instance to draw it the same color as background
style.configure("Tab", focuscolor=style.configure(".")["background"])