from tkinter import *
from tkinter import messagebox as g
import random
from PIL import Image, ImageTk
root = Tk()
root.title('登录界面')
root.geometry('600x600')
m = ''
y = ''
image1 = Image.open('F:\\秦俊芃的学习文件夹\\图片\\to.png')
image2 = ImageTk.PhotoImage(image1)
to = Label(root, image=image2)
to.place(x=180, y=300)
def deng():
y1 = b.get()
m1 = b1.get()
if m1 == m and y1 == y:
def bankab():
def yin_hang_bton():
ka_mima_entry_g = ka_mima_entry.get()
ka_mima_entry1_g = ka_mima_entry1.get()
if ka_mima_entry_g == ka_mima_entry1_g:
g.showinfo('成功', '设置成功')
ka_mima_str = ka_mima_entry.grt()
yin.destroy()
else:
g.showerror('错误', '两次的密码不一样')
yin = Toplevel()
yin.geometry('700x600')
yin.title('办卡')
ka1 = str(random.randint(1,9))
ka2 = str(random.randint(1,9))
ka3 = str(random.randint(1,9))
ka_hao = (ka1+ka2+ka3)
ka_hao = str(ka_hao)
imagea = Image.open('F:\\秦俊芃的学习文件夹\\图片\\ka.png')
image1a = ImageTk.PhotoImage(imagea)
to1a = Label(window, image=image1a)
to1a.place(x=500, y=500)
print_kahao = Label(yin, text=('你的卡号是:', ka_hao), font=('宋体',25)).pack()
ka_mima = Label(yin, text=' 请输入密码 ', font=('宋体',25))
ka_mima.place(x=0, y=60)
ka_mima_entry = Entry(yin, bg='yellow', fg='blue', font=('宋体',25))
ka_mima_entry.place(x=250, y=60)
ka_mima1 = Label(yin, text='请再次输入密码', font=('宋体',25))
ka_mima1.place(x=0, y=100)
ka_mima_entry1 = Entry(yin, bg='yellow', fg='blue', font=('宋体',25))
ka_mima_entry1.place(x=250, y=100)
ka_btn = Button(yin, text='完成', fg='red', command=yin_hang_bton, font=('宋体',25))
ka_btn.place(x=300, y=300)
g.showinfo('成功', '登陆成功')
root.destroy()
window = Tk()
window.geometry('600x600')
window.title('主页面')
image = Image.open('F:\\秦俊芃的学习文件夹\\图片\\kai.png')
image1 = ImageTk.PhotoImage(image)
to1 = Label(window, image=image1)
to1.pack()
banka = Button(window, text='办卡', font=('微软雅黑', 20),fg='yellow', bg='blue', command=bankab).place(x=100, y=300)
root.mainloop()
else:
g.showerror('错误', '密码或用户名错误')
def mimaq():
ag = aa.get()
a1g = aa1.get()
a2g = aa2.get()
a3g = aa3.get()
if ag == a1g and a2g == a3g:
global m, y
y = ag
m = a3g
g.showinfo('成功', '修改成功')
mima.destroy()
else:
g.showerror('错误', '密码或用户名两次输入的不一致')
def wangji():
global aa, aa1, aa2, aa3, mima
mima = Toplevel()
mima.title('注册')
mima.geometry('700x600')
Label(mima, text='请输入新用户名', fg='blue',font=('宋体', 25)).grid(row=0, column=0)
aa = Entry(mima, bg='yellow', fg='blue', font=('宋体', 25))
aa.grid(row=0, column=1)
Label(mima, text = '请再次输入用户名', fg='blue', font=('宋体', 25)).grid(row=1, column=0)
aa1 = Entry(mima, bg='yellow', fg='blue', font=('宋体', 25))
aa1.grid(row=1, column=1)
Label(mima, text = '请输入新密码', fg='blue', font=('宋体', 25)).grid(row=2, column=0)
aa2 = Entry(mima, bg='yellow', fg='blue', font=('宋体', 25))
aa2.grid(row=2, column=1)
Label(mima, text = '请再次输入密码', fg='blue', font=('宋体', 25)).grid(row=3, column=0)
aa3 = Entry(mima, bg='yellow', fg='blue', font=('宋体', 25))
aa3.grid(row=3, column=1)
cc = Button(mima, text='确定', fg='red', font=('微软雅黑',30), command = mimaq)
cc.place(x=300, y=180)
a = Label(root, text='用户名', fg='blue', font=('宋体', 30))
a.grid(row=0, column=0)
b = Entry(root, bg='yellow', fg='blue', font=('宋体', 30))
b.grid(row=0, column=1)
a1 = Label(root, text='密码', fg='blue', font=('宋体', 30))
a1.grid(row=1, column=0)
b1 = Entry(root, bg='yellow', fg='blue', font=('宋体', 30),show='*')
b1.grid(row=1, column=1)
c1 = Button(text='登录', bg='yellow', fg='blue',\
command=deng, font=('微软雅黑',30))
c1.place(x=150,y=100)
c2 = Button(text='忘记密码', bg='yellow', fg='blue',\
command=wangji, font=('微软雅黑',30))
c2.place(x=300,y=100)
root.mainloop()