我正在尝试使用python中的Tkinter制作透明GUI,请帮助我如何制作这种类型的GUI Transparent GUI
class MyInterfaceController: WKInterfaceController {
@IBOutlet var myLabel: WKInterfaceLabel! {
didSet {
myLabel.setTitle("Test")
}
}
答案 0 :(得分:0)
您需要使用wm_attributes:
import tkinter as tk
root = tk.Tk()
# load image
root.image = tk.PhotoImage(file='image.gif')
# disable window movement
root.overrideredirect(True)
# setup start window position
root.geometry("+800+200")
# initialise wm attributes
root.wm_attributes()
# setup transparency
root.wm_attributes("-alpha", 0.5)
# setup label
label = tk.Label(root, image=root.image, bg='white')
label.pack()
label.mainloop()