教你使用 Python 的 Pillow库制作动态验证码
一、安装Pillow
pip install Pillow
二、导入Pillow库
from PIL import ImageDraw,Image,ImageFont,ImageTk
动态图效果展示
三、代码部分
import random,string,tkinter.font as fonts,tkinter,io
from PIL import ImageDraw,Image,ImageFont,ImageTk
# from cacha import *
class ImageGUI(tkinter.Tk):
def GIF_VSER(self,dir:str=None,width:int = 150,color:tuple[int]=(255,255,255),length:int=5):
size = (width,int(60/150*width))
random_str = ''.join(random.choice(string.ascii_uppercase+string.digits) for _ in range(length))
images:list[Image.Image] = []