【发布时间】:2019-11-20 13:38:33
【问题描述】:
所以,我的项目有 3 个窗口,我希望这 3 个窗口具有每个背景图像,但我不知道如何解决这个问题,现在已经花了好几个小时了。这是我的代码..
def Registration():
rootA = Toplevel() # This creates the window, just a blank one.
rootA.geometry("1366x768")
rootA.configure(background="black")
rootA.title('Registation') # This renames the title of said window to 'signup'
rootA.attributes('-fullscreen', True)
image3=Image.open('2.gif')
image4=ImageTk.PhotoImage(image3)
image3_label=Label(borderwidth=0)
image3_label.grid(column=0,row=0)
registrationLabel = Label(rootA, image=image4)
registrationLabel.place(x=0,y=0)
fnameEntry= Entry(rootA)
fnameEntry.place(x=680,y=350,width=200)
def Login():
global nameEL
global pwordEL
global rootA
rootA = Tk()
rootA.geometry("1366x768")
rootA.configure(background="black")
rootA.attributes('-fullscreen', True)
rootA.title('Food Delivery') # This makes the window title 'login'
image2=Image.open('1.gif')
image1=ImageTk.PhotoImage(image2)
image2_label=Label(borderwidth=0)
image2_label.grid(column=0,row=0)
titleLabel = Label(rootA, image=image1)
titleLabel.place(x=0,y=0)
# ====== 这部分现在是我的问题。
def CheckLogin():
with open(creds) as f:
data = f.readlines()
username = data[0].rstrip()
password = data[1].rstrip()
if nameEL.get() == username and pwordEL.get() == password:
#r = Tk() # Opens new window
#r.title('Food Delivery')
#r.geometry('100x80')
#r.title("Food Delivery")
#r.configure(background='pink')
I mean, this part I just label it Tk cos I don't know what to do.
rootA = Tk()
rootA.geometry("1366x768")
rootA.configure(background="black")
rootA.attributes('-fullscreen', True)
rootA.title('Food Delivery')
image2=Image.open('4.gif')
image1=ImageTk.PhotoImage(image2)
image2_label=Label(borderwidth=0)
image2_label.grid(column=0,row=0)
# #我不知道下一步是什么或正确的代码。提前致谢
【问题讨论】:
标签: python-3.x tkinter tkinter-canvas