【发布时间】:2018-10-15 11:14:07
【问题描述】:
这是一个学校项目,所以我有点想了解我在做什么。
我想添加一张照片,例如以“teletubbies.jpg”为背景的照片。我不知道如何做到这一点以及它是如何工作的,现在已经搜索了几个小时并且渴望找到答案:$
这是我现在拥有的代码:
from tkinter import *
from tkinter.messagebox import showinfo
def clicked():
bericht = 'Test for stackflow!',
showinfo(title='popup', message=bericht)
def clicked1():
bericht = 'Test for stackflow'
showinfo(title='popup', message=bericht)
root = Tk()
label = Label(master=root,
text='This is a test for stackflow',
background='black',
foreground='white',
height = 2
)
label.pack()
button2 = Button(master=root, text='Klik hier voor het beheerportaal', command=clicked, fg='red')
button2.pack(side=BOTTOM,pady=10)
button1 = Button(master=root, text='Klik hier voor het klantportaal', command=clicked1)
button1.pack(side=TOP,pady=10)
entry = Entry(master=root)
entry.pack(padx=10, pady = 10)
root.configure(background='black')
root.mainloop()
【问题讨论】: