tkinter.ttk.Style.configure()

configure(style, query_opt=None, **kw)

Query or set the default value of the specified option(s) in style.

Each key in kw is an option and each value is a string identifying the value for that option.

For example, to change every default button to be a flat button with some padding and a different background color:

1
2
3
4
5
6
7
8
9
10
11
12
from tkinter import ttk
import tkinter
 
root = tkinter.Tk()
 
ttk.Style().configure("TButton", padding=6, relief="flat",
   background="#ccc")
 
btn = ttk.Button(text="Sample")
btn.pack()
 
root.mainloop()
doc_python
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.