टिंकर एप्लिकेशन में विजेट के गुणों को कॉन्फ़िगर करने के लिए, हम आम तौर पर 'कॉन्फ़िगर (**विकल्प) का उपयोग करते हैं। ' तरीका। हम एप्लिकेशन में पृष्ठभूमि रंग, फ़ॉन्ट गुण और विजेट के अन्य विशिष्ट गुणों को अनुकूलित कर सकते हैं।
ऐसा कोई मामला हो सकता है जब हम विजेट के पृष्ठभूमि रंग को गतिशील रूप से बदलना चाहते हैं। हालांकि, हम रंगों की सूची को भी परिभाषित कर सकते हैं और सूची में पुनरावृति करते हुए रंग बदल सकते हैं।
उदाहरण
#Import the required libraries
from tkinter import *
from random import shuffle
import time
#Create an instance of Tkinter frame
win = Tk()
win.geometry("700x250")
#Add fonts for all the widgets
win.option_add("*Font", "aerial")
# Define the backround color for all the widgets
def change_color():
colors= ['#e9c46a','#e76f51','#264653','#2a9d8f','#e85d04','#a2d2ff','#06d6a0','#4d908e']
while True:
shuffle(colors)
for i in range(0,len(colors)):
win.config(background=colors[i])
win.update()
time.sleep(1)
#Display bunch of widgets
label=Label(win, text="Hello World", bg= 'white')
label.pack(pady= 40, padx= 30)
#Create a Button to change the background color of the widgets
btn=Button(win, text="Button", command= change_color)
btn.pack(pady= 10)
win.mainloop() आउटपुट
जब हम उपरोक्त कोड को संकलित करते हैं, तो यह एक लेबल विजेट और एक बटन के साथ एक विंडो प्रदर्शित करेगा।

जब हम बटन दबाते हैं, तो यह change_color() . को कॉल करेगा फ़ंक्शन जो विंडो के पृष्ठभूमि रंग को गतिशील रूप से बदलता है।
