I have a TTK Button in my app and I want to style it but the problem is that some of these styles don't work. Here is my style for the button:
style.configure("Menu.TButton", font=("Times New Roman", 20), width=300, padx=20, anchor=W, background="#21252B", foreground="#fff", activebackground="#BD93F9", bd=0)
But with this style, the foreground
just puts a white overlay on the button, background
doesn't work at all, activebackground
also doesn't work at all, and padx
also doesn't work.
So are the names for these styles different or am I doing something wrong?
if it helps here is the code for the button:
home_button = Button(menu_frame, style="Menu.TButton", text="Home")
home_button.grid(column=0, row=1)
and here is how to looks:
here some options you can play around:
toolstyle = ttk.Style()
toolstyle.theme_use("clam") # "default", "alt" .....
toolstyle.configure('TButton',
background="black",
foreground="white",
borderwidth=1,
bordercolor="red",
lightcolor="yellow",
darkcolor="purple",
focuscolor="none",
font=("Bahnschrift", 14),
width=2)
toolstyle.map('TButton',
background=[("pressed", "white"),
("active", "grey")],
borderwidth=[("active", 0)],
bordercolor=[("active", "blue")],
lightcolor=[("active", "purple")],
darkcolor=[("active", "black")],
foreground=[("pressed", "black"),
("active", "red")]
)