tkinter 위젯의 테두리 색상을 변경하고 싶다고 가정해 봅시다. highlightcolor, highlightbackground를 전달하여 위젯을 구성할 수 있습니다. 위젯의 속성입니다.
예시
이 예에서는 항목 위젯과 항목 위젯의 테두리 색상을 변경하기 위해 트리거될 수 있는 버튼을 만들었습니다.
#Import the required libraries
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the geometry of frame
win.geometry("600x250")
#Define a function to change the color of entry widget
def change_color():
text.config(highlightthickness=2, highlightbackground="red")
#Create a Entry widget for which we want to change the border color
text= Entry(win, width= 50)
text.pack()
#Create a Button Widget
button= Button(win, text= "Change", command=change_color)
button.pack(pady=20)
win.mainloop() 출력
위의 코드를 실행하면 입력 위젯의 테두리 색상을 변경하는 데 사용할 수 있는 버튼이 포함된 창이 표시됩니다.

이제 "변경" 버튼을 클릭하여 위젯의 테두리 색상을 변경합니다.
