किसी एप्लिकेशन की संरचना को फ्रेम करने और विजेट को कॉन्फ़िगर करने के लिए टिंकर में कई विशेषता विशेषताएँ और गुण हैं। इस लेख में, हम देखेंगे कि एक पारदर्शी पृष्ठभूमि के साथ टिंकर विजेट कैसे सेट करें। wm_attributes('-transparentcolor', 'color') विजेट को पारदर्शी पृष्ठभूमि प्रदान करने के लिए विधि का उपयोग किया जाता है।
उदाहरण
इस उदाहरण में, हम पारदर्शी पृष्ठभूमि वाला एक लेबल विजेट बनाएंगे।
#Import the required libraries
from tkinter import *
#Create an instance of Tkinter Frame
win = Tk()
#Set the geometry
win.geometry("700x350")
#Adding transparent background property
win.wm_attributes('-transparentcolor', '#ab23ff')
#Create a Label
Label(win, text= "Hello World!", font= ('Helvetica 18'), bg= '#ab23ff').pack(ipadx= 50, ipady=50, padx= 20)
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से एक विंडो प्रदर्शित होगी जिसमें पारदर्शी पृष्ठभूमि वाला एक लेबल होगा।
