Tkinter 插入图片背景
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Tkinter import *
from PIL import ImageTk,Image
app = Tk()
app.title("Welcome")
image2 =Image.open(r'C:\Python27\tcl\tk8.5\demos\images\earth.gif')
background_image = ImageTk.PhotoImage(image2)
w = background_image.width()
h = background_image.height()
app.geometry('%dx%d+0+0' % (w,h))
background_label = Label(app, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
for x in ('button1','button2','button3'):
btn=Button(app,text=x)
btn.pack()
app.mainloop()
转自: https://www.cnblogs.com/buchizaodian/p/7076964.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)