#!/venv/bin/python3.11
import tkinter as tk
# Create main window
root = tk.Tk()
root.title("tk.Button All Attributes Example")
root.geometry("400x400")
# Button with many attributes
btn = tk.Button(root,
text="Custom Button",
fg="white", # Foreground (text color)
bg="blue", # Background color
font=("Arial", 14, "bold"), # Font type, size, and weight
relief="raised", # Border style ('flat', 'raised', 'sunken', etc.)
width=20, # Width (in characters)
height=2, # Height (in lines)
padx=10, # Horizontal padding inside the button
pady=10, # Vertical padding inside the button
state="normal", # Button state ('normal', 'disabled', 'active')
highlightthickness=3, # Thickness of highlight border
highlightbackground="red", # Border color when button is not focused
highlightcolor="green", # Border color when button is focused
#highlightshadow="yellow", # Color of shadow under the highlight border
bd=5, # Border width
anchor="center", # Text alignment inside the button
activebackground="purple", # Background color when button is pressed
activeforeground="yellow", # Text color when button is pressed
command=lambda: print("Button clicked!")) # Function to run when button is clicked
btn.pack(pady=50)
# Run the GUI loop
root.mainloop()