【发布时间】:2012-04-16 19:42:14
【问题描述】:
如何将按钮小部件放在背景图像之上?
from Tkinter import *
import tkMessageBox
root = Tk()
# load image
logo = PhotoImage(file="C:\\Users\\admin\\Desktop\\project\\front page.gif")
w = logo.width()
h = logo.height()
root.geometry('%dx%d+0+0' % (w,h))
def helloCallBack():
tkMessageBox.showinfo("Hello Python", "Hello World")
#create widgets
B = Button(root,text = "ASSOCIATIONS", command = helloCallBack,width = 20,padx = 20)
B.pack()
B1 = Button(root,text = "HELP", command = helloCallBack,width = 20,padx = 20)
B1.place(relx=1, x=-50, y=2, anchor=NE)
B1.pack()
w1 = Label(root, compound = CENTER, image = logo).pack(side="right")
root.mainloop()
【问题讨论】: