Tkinter:如何更改按钮边框的颜色?

时间:2020-03-23 14:25:40

标签: button tkinter colors border

如何更改此代码中定义的按钮(b1)的边框颜色?

import tkinter as tk

# style:
def button_style(button):
    button.configure(activebackground="#ececec")
    button.configure(activeforeground="#000000")
    button.configure(background="#e1e1e1")
    button.configure(borderwidth="1", relief="solid")
    button.configure(disabledforeground="#a3a3a3")
    button.configure(foreground="#000000")
    button.configure(highlightbackground="#d9d9d9")
    button.configure(highlightcolor="black")
    button.configure(pady="0") 

# main window:
mw = tk.Tk()
mw.title("test")

# button:
b1 = tk.Button(mw, text="Polcies Tool")
b1.place(relx=0.06, rely=0.125, height=28, width=108)
button_style(b1)

# main loop:
mw.mainloop()

如您所见,按钮边框颜色为黑色,请购买我要在“ #adadad”中进行更改的颜色: enter image description here

0 个答案:

没有答案