หน้าต่าง Tkinter มีฟังก์ชันและคุณสมบัติในตัวมากมาย เพื่อช่วยให้แอปพลิเคชันทำงานได้อย่างราบรื่น พวกเขากำหนดค่า GUI ของแอปพลิเคชันเช่นกัน
หากเราต้องการสร้างหน้าต่างโปร่งใสในแอปพลิเคชัน เราควรกำหนดสีใน attributes('-transparentcolor', 'color' ) กระบวนการ. ด้วยการให้สีของหน้าต่างและวิดเจ็ต มันจะทำให้หน้าต่างโปร่งใส
ตัวอย่าง
#Import the Tkinter Library
from tkinter import *
#Create an instance of Tkinter Frame
win = Tk()
#Set the geometry of window
win.geometry("700x350")
#Add a background color to the Main Window
win.config(bg = '#add123')
#Create a transparent window
win.wm_attributes('-transparentcolor','#add123')
win.mainloop() ผลลัพธ์
การเรียกใช้โค้ดด้านบนจะแสดงหน้าต่างที่มีพื้นหลังโปร่งใส
