मान लीजिए कि हम टिंकर विजेट के बॉर्डर कलर को बदलना चाहते हैं। हम हाइलाइटरंग, हाइलाइटबैकग्राउंड . पास करके विजेट को कॉन्फ़िगर कर सकते हैं विजेट की संपत्ति।
उदाहरण
इस उदाहरण में, हमने एक एंट्री विजेट और एक बटन बनाया है जिसे एंट्री विजेट के बॉर्डर रंग को बदलने के लिए ट्रिगर किया जा सकता है।
#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() आउटपुट
उपरोक्त कोड को चलाने से एक विंडो प्रदर्शित होगी जिसमें एक बटन होगा जिसका उपयोग प्रवेश विजेट के बॉर्डर रंग को बदलने के लिए किया जा सकता है।

अब विजेट के बॉर्डर का रंग बदलने के लिए "बदलें" बटन पर क्लिक करें।
