हम tkinter.ttk मॉड्यूल का उपयोग करके tkinter विजेट्स को अनुकूलित कर सकते हैं। Tkinter.ttk मॉड्यूल का उपयोग टिंकर विजेट्स को स्टाइल करने के लिए किया जाता है जैसे कि पृष्ठभूमि का रंग सेट करना, अग्रभूमि का रंग, बटन को सक्रिय करना, लेबल में चित्र जोड़ना, विजेट की ऊंचाई और चौड़ाई को सही ठहराना, आदि।
टिंकर विजेट में पृष्ठभूमि रंग जोड़ने के लिए, हम पृष्ठभूमि निर्दिष्ट कर सकते हैं विजेट में संपत्ति।
उदाहरण
निम्नलिखित उदाहरण में, हम एक बटन बनाएंगे जो टेक्स्ट लेबल की पृष्ठभूमि को बदल देगा।
#Import the tkinter library
from tkinter import *
from tkinter.ttk import *
#Create an instance of tkinter frame
win = Tk()
#Set the geometry
win.geometry("600x400")
#Add a class to style the tkinter widgets
style = ttk.Style()
style.configure('TEntry', foreground = 'red')
#Define a function to change the text color
def change_color():
text.configure(background="red")
#Create a text widget
text=Label(win,text="This is a New Text",foreground="black",
background="yellow",font=('Aerial bold',20))
text.pack(pady=20)
#Create a Button widget
Button(win, text= "Click Here", command= change_color).pack(pady=10)
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से "पीले" पृष्ठभूमि रंग के साथ एक टेक्स्ट लेबल वाली एक विंडो बन जाएगी।

अब, "यहां क्लिक करें" बटन पर क्लिक करें। यह टेक्स्ट लेबल की पृष्ठभूमि का रंग "लाल" में बदल देगा।
