鱼C论坛

 找回密码
 立即注册
查看: 746|回复: 2

问题

[复制链接]
头像被屏蔽
发表于 2020-4-27 13:03:46 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-4-27 13:04:15 | 显示全部楼层
  1. from tkinter import *
  2. from tkinter import messagebox as g
  3. import pickle
  4. import random

  5. # from PIL import Image, ImageTk

  6. # password = 'python'
  7. # pickle_file = open('./password.pkl','wb')
  8. # pickle.dump(password,pickle_file)
  9. # pickle_file.close()

  10. pickle_file = open(r".\password.pkl","rb")
  11. password = pickle.load(pickle_file)

  12. ci_shu = 0

  13. tk = Tk()
  14. tk.title('账号登陆')
  15. tk.geometry('400x450')

  16. system = StringVar(value='flat')  # FLAT

  17. var = StringVar(value='Administrator')
  18. var1 = StringVar(value='')

  19. def enter(ev = None):
  20.     system.set('ridge')   #RIDGE

  21. def leave(ev = None):
  22.     system.set('flat')
  23.    

  24. def yan_zheng(ev = None):

  25.     zhang_hao_get = zhang_hao.get()
  26.     mi_ma_get = mi_ma.get()

  27.     if zhang_hao_get == 'Administrator' and mi_ma_get == password:
  28.         g.showinfo('', '登录成功')
  29.         tk.destroy()

  30.     else:
  31.         var1.set('')
  32.         g.showerror('', '用户名或密码错误')
  33.         ci_shu + 1

  34. def chongzhi():
  35.     var1.set('')
  36.     var.set('Administrator')



  37. # img_gif = PhotoImage(file = r'C:\Users\Administrator\Desktop\apple.gif')


  38. # button_img = Button(root, image = img_gif, text = '带图按钮')
  39. # button_img.pack()

  40. Label(tk, text='账号', font=('楷书', 20)).place(x=10, y=10)

  41. zhang_hao = Entry(tk, fg='blue', font=('楷书', 20), textvariable=var)
  42. zhang_hao.place(x=70 ,y=10)
  43. zhang_hao.bind('<Return>', yan_zheng)

  44. Label(tk, text='密码', font=('楷书', 20)).place(x=10, y=50)

  45. mi_ma = Entry(tk, fg='blue', font=('楷书', 20) ,show='●', textvariable=var1)
  46. mi_ma.place(x=70, y=50)
  47. mi_ma.bind('<Return>', yan_zheng)# redge

  48. deng_lu = Button(tk, text='登录', fg='blue', font=('楷书', 20) ,command=yan_zheng)# RIDGE  , relief=syst
  49. deng_lu.place(x=10, y=100)

  50. deng_lu.bind("<Enter>", enter)
  51. deng_lu.bind("<Leave>", leave)

  52. chong_zhi = Button(tk, text='重置', fg='blue', font=('楷书', 20), command=chongzhi)
  53. chong_zhi.place(x=120, y=100)



  54. tk.mainloop()
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-4-27 13:05:13 | 显示全部楼层
所以你想问什么???
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-18 04:53

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表