from tkinter import *
from tkinter.messagebox import *
import random
root = Tk()
gif = ["验证码0", "验证码1", "验证码2", "验证码3", "验证码4", "验证码5", "验证码6", "验证码7", "验证码8", "验证码9", "验证码10", "验证码11", "验证码12"]
note = ["36uad", "eun2p", "tqy19", "1tt8i", "1gria", "4gsah", "2q6gy", "2gnf7", "q4q1y", "5qhi6", "1ferh", "wtyiq2",
"5ttyi"]
def setgif():
global many
global maxp
global ranima
global frames
many = random.randint(0, len(gif) - 1)
ranima = './cap/' + gif[many] + '.gif'
maxp = 6
frames = [PhotoImage(file=ranima, format='gif -index %i' % (i)) for i in range(maxp)]
showp(0)
def showp(x):
global maxp
global frames
frame = frames[x]
x += 1
label = Label(root, image=frame, height=23).grid(column=2, row=1)
root.after(800, showp, x % maxp)
def dupass():
global many
if str(note[many]).lower() == m_str_var.get().strip("").lower():
warn = showwarning(title='04_动态验证码', message='验证通过,将退出系统!')
root.destroy()
else:
warn = showwarning(title='04_动态验证码', message='验证码不正确,请重新输入!')
setgif()
def close():
root.destroy()
root.title('04_动态验证码')
root.wm_attributes('-topmost', 1)
root.geometry('450x110')
image1 = PhotoImage(file='sport.png')
add = Label(root, text='新增会员', image=image1).grid(column=0, row=0)
explain = Label(root, text='请输入验证码:').grid(column=0, row=1)
m_str_var = StringVar()
cap = Entry(text='0', textvariable=m_str_var, width=10).grid(column=1, row=1)
actre = Button(root, text="换一张", relief=FLAT, command=setgif, width=10)
actre.grid(column=3, row=1)
actis = Button(root, text="确认", command=dupass, width=10)
actis.grid(column=2, row=2)
actend = Button(root, text="退出", command=close, width=10)
actend.grid(column=3, row=2)
setgif()
root.mainloop()
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
python3实现动态验证码.zip (16个子文件)
04_动态验证码
sport.png 618B
生产指定长度验证码.py 936B
demo.py 2KB
cap
验证码6.gif 11KB
验证码4.gif 8KB
验证码2.gif 16KB
验证码0.gif 13KB
验证码10.gif 11KB
验证码11.gif 9KB
验证码9.gif 12KB
验证码8.gif 7KB
验证码1.gif 14KB
验证码3.gif 7KB
验证码12.gif 11KB
验证码7.gif 12KB
验证码5.gif 7KB
共 16 条
- 1
资源评论
数据知道
- 粉丝: 5w+
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功