在 Python Tkinter 中建立透明視窗
Python 是用於開發和建立函式和桌面應用程式的最流行語言。它擁有豐富的不同模組和函式庫,可提供可擴充套件性和可訪問性以建立和開發應用程式。
Tkinter 是用於建立基於 GUI 的應用程式的最常用庫。它具有新增小部件和其他必要屬性等功能。
假設我們想要使用 tkinter 建立一個透明視窗。為了建立透明視窗,我們可以使用 attributes 屬性並定義 opacity 值。
示例
#Importing the tkinter library
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Define the size of the window or frame
win.geometry("700x400")
#To Make it transparent use alpha property to define the opacity of
the frame
win.attributes('-alpha', 0.3)
win.mainloop()輸出
執行以上程式碼將產生輸出並顯示一個透明視窗。

廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP