【发布时间】:2015-04-21 18:35:33
【问题描述】:
使用 tkinter 在背景图像上的按钮、标签等。几天前我刚开始学习python,所以如果这个问题看起来很傻,我很抱歉..我的代码在下面..但此时标签显示在图像下方而不是图像上方..请纠正我。
import tkinter
haren = tkinter.Tk()
width, height = haren.winfo_screenwidth(), haren.winfo_screenheight()
bg = tkinter.PhotoImage(file="img/bg.png")
panel1 = tkinter.Label(haren, image=bg)
panel1.pack(side='top', fill='both', expand='yes')
haren.wm_title("Hi Sana")
haren.grid()
yeah=tkinter.Label(haren, text="Developed by Full Mad Haren Sarma")
yeah.pack()
haren.wm_geometry("%dx%d+0+0" % (width, height))
haren.mainloop()
【问题讨论】: