python3tkinter怎样更换背景图片_如何使用Tkinter Python2.7将背景图像设置为窗口

我正在设置背景图像,并在该图像上添加标签,按钮和所有。一切都来了,但不是在背景图像上,它是这样的:

我的代码是:from Tkinter import Tk, Frame, BOTH

import Tkinter

from PIL import Image, ImageTk

class Example(Frame):

def __init__(self, parent):

Frame.__init__(self, parent)

self.parent = parent

self.initUI()

def initUI(self):

self.parent.title("PISE")

self.pack(fill=BOTH, expand=1)

root = Tk()

root.geometry("1111x675+300+300")

app = Example(root)

im = Image.open('wood.png')

tkimage = ImageTk.PhotoImage(im)

Tkinter.Label(root,image = tkimage).pack()

custName = StringVar(None)

yourName = Entry(app, textvariable=custName)

yourName.pack()

relStatus = StringVar()

relStatus.set(None)

labelText = StringVar()

labelText.set('Accuracy Level')

label1 = Label(app, textvariable=labelText, height=2)

label1.pack()

radio1 = Radiobutton(app, text='100%', value='1', variable = relStatus, command=beenClicked1).pack()

radio2 = Radiobutton(app, text='50%', value='5', variable = relStatus, command=beenClicked5).pack()

root.mainloop()

如何正确地匹配背景图像?

提前谢谢!

你可能感兴趣的:(python3tkinter怎样更换背景图片_如何使用Tkinter Python2.7将背景图像设置为窗口)