टीटीके टिंकर में थीम वाले विजेट को एप्लिकेशन में विजेट के बाहरी गुणों और शैलियों को डिजाइन करने के लिए पेश किया गया है। टीटीके T . का उपयोग करता है cl/Tk दुभाषिया उपयोगकर्ता को इंटरफ़ेस तक पहुंच प्रदान करने के लिए जिसमें कई अंतर्निहित विशेषताएं और विशेषताएं हैं जो किसी भी विजेट या एप्लिकेशन के लिए उपयोगी हैं। अब, अगर हम तुलना करें Ttk Tcl . के साथ थीम थीम, इसमें बहुत सारी विविधताएं हैं।
टीटीके आम तौर पर केवल कुछ विषयों का समर्थन करता है जो इस प्रकार हैं -
- विजेता
- क्लैम
- alt
- डिफ़ॉल्ट
- क्लासिक
- विस्टा
- xpnative
टिंकर एप्लिकेशन की समग्र थीम को बदलने के लिए, हमें style.theme_use(theme_name) फ़ंक्शन का उपयोग करना होगा। ।
उदाहरण
# Import the required libraries in tkinter
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
# Create an instance of tkinter frame or window
win = Tk()
# Set the size of tkinter window
win.geometry("700x350")
# Create an instance of ttk Style
style = ttk.Style()
# Configure the theme with style
style.theme_use('clam')
# Define a function to show the message
def display_msg():
messagebox.showinfo("Message", "You are learning Python Tkinter!")
# Add a Customized Label widget
label = ttk.Label(win, text="Hey Folks, I have a Message for You!", font=('Aerial 16'))
label.pack(pady=5)
# Add a Button widget
ttk.Button(win, text="Show Message", command=display_msg).place(x=285, y=98)
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से एक लेबल विजेट और एक बटन के साथ एक विंडो खुलेगी। एप्लिकेशन का समग्र विषय ttk . द्वारा परिभाषित किया गया है थीम्ड विजेट। हम थीम को टिंकर लाइब्रेरी में उपलब्ध थीम की सूची से कॉन्फ़िगर कर सकते हैं
