Search code examples
pythontkinterttk

Tkinter Frame Color


I'm trying to modify a Tkinter Frame using ttk.Style to customize the color of a Tkinter Frame and have even tried a ttk.Frame to use HEX colors for a frame background but can't get it to work, here is my code:

self.style.theme_create( "rePOS", parent="alt", settings={
            "TNotebook.Tab": {
                "configure": {"padding": [20, 10], "background": self.tabColor },
                "map":       {"background": [("selected", self.tabSelectedColor)]},

            },
            "TFrame": {
                "background": "#77cd00"
            }
        }
    )

Any ideas?


Solution

  • I found the solution on another question similar, it seems using this works:

    color = '#%02x%02x%02x' % (119, 205, 000)'
    

    Using this with an RGB color works and setting it so the color variable will produce the background.