tkinter change ttk button color 1

tkinter change ttk button color

button = tk.Button(root, text="Sign Out", bg='red', command= lambda: controller.show_frame(10)) #, highlightthickness = 0, bd = 0)
button.grid(row=3, column=0, sticky='ne', padx=20, pady=50)

Here is what the above code is Doing:
1. We create a button widget.
2. We set the text of the button to “Sign Out”.
3. We set the background color of the button to red.
4. We set the command of the button to a lambda function that calls the show_frame method of the controller object.
5. We set the grid position of the button to row=3, column=0.
6. We set the sticky attribute of the button to ‘ne’ (north east).
7. We set the padding of the button to 20 pixels on the x axis and 50 pixels on the y axis.

Similar Posts