Search code examples
pythontkinter

How do I style a ttk.LabelFrame, specifically the background color?


I am trying to add some custom styling to a ttk.LabelFrame. My code looks like this:

root=Tk()
style = ttk.Style()
style.configure('TLabelFrame', background='SystemWindow')
style.configure('TFrame', background='SystemWindow')

The ttk.Frame styling works so I am not sure what is different here.

Edit: Also how can I style the label in the LabelFrame?


Solution

  • For anyone that views this line 2 in the code above should read style.configure('TLabelframe', background='SystemWindow'). I found a similar question here. Cheers!

    Set style for Checkbutton or Labelframe in python tkinter