iT邦幫忙

1

新手,照片不能显示出来,一开始的登录页面可以,忘记密码页面就出现这个问题了tkinter.TclError: image "pyimage3" doesn't exist。请求大哥们帮忙解决,感恩!

  • 分享至 

  • xImage

from tkinter import *
from PIL import ImageTk,Image
import pickle
from tkinter import messagebox
import webbrowser

window = Tk()
window.title('Login Page')
window.geometry('1397x800')

#BG Image
canvas = Canvas(window,height=800,width=1397)
image_file = ImageTk.PhotoImage(file='C:\Users\User\OneDrive\Pictures\images\nocrime.gif')
image = canvas.create_image(0,0,anchor='nw',image=image_file)
canvas.pack()

#Login Frame
frame_login = Frame(window,bg='white')
frame_login.place(x=800,y=70,height=500,width=500)

#title
title = Label(frame_login,text='Login',font=('Times New Roman',35,'bold'),fg='#3077cc',bg='white')
title.place(x=190,y=20)

#email
email = Label(frame_login,text='Email Address :',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
email.place(x=50,y=120)
text_email = Entry(frame_login,font=('Times New Roman',15,'bold'),fg='black',bg='#87a2bf')
text_email.place(x=50,y=150,width=400,height=35)

#password
password = Label(frame_login,text='Password :',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
password.place(x=50,y=210)
text_password = Entry(frame_login,font=('Times New Roman',15,'bold'),fg='black',bg='#87a2bf',show='*')
text_password.place(x=50,y=240,width=400,height=35)

#register Frame
frame_register = Frame(window,bg='white')
frame_register.place(x=800,y=620,height=100,width=500)

#new user
newuser = Label(frame_register,text='New user?',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
newuser.place(x=125,y=35)

def forgot_password():
window_for = Tk()
window_for.title('Forgot Password Page')
window_for.geometry('1397x800')

#BG Image
canvas = Canvas(window_for,height=800,width=1397)
image_file = ImageTk.PhotoImage(file='C:\\Users\\User\\OneDrive\\Pictures\\images\\nocrime.gif')
image = canvas.create_image(0,0,anchor='nw',image=image_file)
canvas.pack()

#forgot Frame
frame_forgot = Frame(window_for,bg='white')
frame_forgot.place(x=800,y=70,height=550,width=500)

#title
title = Label(frame_forgot,text='Forgot Password',font=('Times New Roman',35,'bold'),fg='#3077cc',bg='white')
title.place(x=80,y=20)

#email
email = Label(frame_forgot,text='Email Address :',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
email.place(x=50,y=120)

text_email = Entry(frame_forgot,font=('Times New Roman',15,'bold'),fg='black',bg='#87a2bf')
text_email.place(x=50,y=150,width=400,height=35)

#password
password = Label(frame_forgot,text='New Password :',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
password.place(x=50,y=210)

text_password = Entry(frame_forgot,font=('Times New Roman',15,'bold'),fg='black',bg='#87a2bf')
text_password.place(x=50,y=240,width=400,height=35)


#comfirm password
comfirm_password = Label(frame_forgot,text='Comfirm Password :',font=('Times New Roman',15,'bold'),fg='grey',bg='white')
comfirm_password.place(x=50,y=300)

text_comfirm_password = Entry(frame_forgot,font=('Times New Roman',15,'bold'),fg='black',bg='#87a2bf')
text_comfirm_password.place(x=50,y=330,width=400,height=35)

#eye button
eyefor_image = PhotoImage(file='C:\\Users\\User\\OneDrive\\Pictures\\images\\show-password (1).png')
eyefor_image_label = Label(frame_forgot,image=eyefor_image,bg='#87a2bf')
eyefor_image_label.place(x=412,y=241)
eyefor_button = Button(frame_forgot,image=eyefor_image,borderwidth=0,bg='#87a2bf')
eyefor_button.place(x=412,y=331)

#reset password button
reset_password_button = Button(frame_forgot,text='RESET PASSWORD',font=('Times New Roman',15,'bold'),borderwidth=10,bg='#3077cc',fg='white')
reset_password_button.place(x=130,y=420,height=60,width=240)

#login button
login_button = Button(frame_login,text='LOGIN',font=('Times New Roman',15,'bold'),borderwidth=10,bg='#3077cc',fg='white')
login_button.place(x=130,y=390,height=60,width=240)

#forget pass btn
forget_button = Button(frame_login,text='Forget Password?',font=('Times New Roman',15,'bold','underline'),borderwidth=0,bg='white',fg='#3077cc',command=forgot_password)
forget_button.place(x=50,y=290)

def hide_eye():
if text_password.cget('show') == '':
text_password.config(show='*')
else:
text_password.config(show='')

#eye button
eye_image = PhotoImage(file='C:\Users\User\OneDrive\Pictures\images\show-password (1).png')
eye_image_label = Label(frame_login,image=eye_image,borderwidth=0)
eye_image_label.place(x=412,y=241)
eye_button = Button(frame_login,image=eye_image,borderwidth=0,bg='#87a2bf',command=hide_eye)
eye_button.place(x=412,y=241)

#create an acc btn
acc_button = Button(frame_register,text='Create an account',font=('Times New Roman',15,'bold','underline'),borderwidth=0,bg='white',fg='#3077cc')
acc_button.place(x=220,y=33)

window.mainloop()

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
tcvwqxh8
iT邦新手 5 級 ‧ 2022-03-03 19:40:28
讚讚讚

我要發表回答

立即登入回答