我想为我的python脚本创建一个GUI
我设法定义了一个背景,现在我想添加我的按钮,但问题是在这里。就像你在下面的屏幕上看到的
这是我的代码中定义图像的部分
root = tk.Tk()
root.wm_attributes("-topmost", True)
root.wm_attributes("-transparent", True)
root.config(bg='systemTransparent')
NewAccountImg=tk.PhotoImage(file="NewAccountImg.gif")
background_image=tk.PhotoImage(file="fond.png")
background_label=tk.Label(root, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
以及
root.newaccount = tk.Button(root,text="New Account",command=partial(Set_Acc_and_Hide,root),image=NewAccountImg)
如何使我的按钮透明
你应该使用PIL库来处理图像
PIL支持透明
举个例子:
相关问题 更多 >
编程相关推荐