Ttk Styling in Tkinter

I’m not getting how apply different styling attributes on Option Menu in Tkinter using ttk module. It is continuously showing errors regarding the same. And is there any way we can curve the edges of widgets like Buttons, Label, etc., make borders disappear on particular sides, and many different styling options like we use to do in CSS

It may be better if you posted some code that demonstrates the issue you have. If you do, then don’t forget to do that, using Markdown formatting:

```python
your code
```

Applying styles is done in two ways. If you have a number of widgets that may dynamically be styled, use configure with a style. If you want the base of all or most of your widgets change their appearance use a theme.

I have not used themes in my apps, but the following snippets from a working program show how to use styling for visual clues when an entry has an invalid value.

First the definition of the style:

        self.entry_error_style = ttk.Style()
        self.entry_error_style.configure('Err.TEntry', foreground='red', fieldbackground='pink')

The fact that it contains the name TEntry after the dot, means that this is a change tot the style TEntry, so all styling of the original theme is still available.

To use it, the following applies:

        try:
            self.back_estimated_hours.set_bedrag(self.bedrag_as_string.get())
            self.bedrag_as_string.set(self.back_estimated_hours.bedrag)
            self.bedragentry.configure(style='TEntry')
        except PriceError as pe:
            self.bedragentry.configure(style='Err.TEntry')
            self.winfo_toplevel().change_status(str(pe))

On a PriceError the self.bedragentry input field will have a pink background and red text. Don’t forget to reset it.

I have not worked with themes myself, so I cannot help you how to create these.

On pypi there is the ttkthemes package which contains several themes to use. I have never done that and pypi suggests that Python releases after 3.8 are not supported by the package. Maybe for later releases you can make use of the package to have examples.

Will try this “ttkthemes”. Thanks for your interest. :grinning: