吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 8813|回复: 72
收起左侧

[原创工具] 小小辅助工具,提取135收费的SVG动画辅助 用于微信公众号文章

  [复制链接]
ihhz 发表于 2023-5-31 11:29
本帖最后由 ihhz 于 2024-3-6 09:53 编辑

提取了一些135收费的SVG动画辅助 用于微信公众号文章排版的小小工具~~~支持粘贴板和增加放入SVG文件夹下
链接: https://pan.baidu.com/s/1UfAcGzF8UkhXovTHI2C57A?pwd=mrvf 提取码: mrvf 复制这段内容后打开百度网盘手机App,操作更方便哦

[Python] 纯文本查看 复制代码
import random
import tkinter
from tkinter import ttk, messagebox  # 有Combobox、LabelFrame 组件时需要本语句
import os
import glob
import re
import pyperclip
import win32clipboard as wc
import time
import threading


def getCopyTxet():
    try:
        wc.OpenClipboard()
        copytxet = wc.GetClipboardData()
    except:
        copytxet = ''

    wc.CloseClipboard()
    return str(copytxet)




text = ['']
gdata=[]
MyPath = r'.\SVG'
os.chdir(MyPath)
ctrllist1 = sorted(glob.glob('*.svg'))
print(len(ctrllist1),ctrllist1)
ctrllist1.append('~~粘贴板~~~')
ctrllist1.insert(0,'~~粘贴板~~~')
endtt= len(ctrllist1)
if len(ctrllist1) < 1:
    ctrllist1 = '没有文件~~'
for i in range(1,len(ctrllist1)-1):
    tt =[]
    with open(ctrllist1[i], "r", encoding="utf-8") as f:
        tt= f.read()
    text.append(tt)
# print(text)


def open():
    global  it,str_tp1,str_tp2,str_tp3,str_tp4,str_tp5,html,res1,endtt,isn
    res1 = []
    tt =ctrl_file.get()
    for i in range(len(ctrllist1)-1):
        if tt == ctrllist1[i]:
            isn = i
            break
        else:
            isn =False
    print('isn',isn,tt)
    if isn==False:
        getd=getCopyTxet()
        # print('g',getd)
        sdata1 = re.search('<svg', getd)
        # print(sdata1)
        if sdata1!= None:
            html = getd
        else:
            messagebox.showinfo('提示', '粘贴板里没有发现是SVG模板~~')
            return
        isn=True
    else:
        html = text[isn]
    #读取图片1

    com1 = re.compile('".*?"',re.S)
    res1 = []
    print('tup',res1)
    html = re.sub('url\(".*?"\)', 'url("http:55667")', html)
    res1 = com1.findall(html)
    for i in range(len(res1)):
        res1[i] = res1[i].strip('"')
        print(res1[i])
    #读取图片2
    com2 = re.compile('\(h.*?\)',re.S)
    res2 = []
    res2 = com2.findall(html)
    for i in range(0,len(res2)):
        res2[i] = res2[i].strip('(').strip(')')
    # print(len(res2),res2)
    res1 = res1+res2
    print(len(res1),res1)
    it = len(res1)

    ctrl_LabelFileName = tkinter.Label(root, text='图片1', fg='#FF0000', font=('宋体', '10', 'bold', 'underline'))
    ctrl_LabelFileName.place(x=22, y=58, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=58
    str_tp1 = tkinter.StringVar()  # 绑定变量
    ctrl_tp1 = tkinter.Entry(root, textvariable=str_tp1, font=('宋体', '9'))
    ctrl_tp1.place(x=101, y=50, width=295, height=22)
    ctrl_LabelFileName = tkinter.Label(root, text='图片2', fg='#FF0000', font=('宋体', '10', 'bold', 'underline'))
    ctrl_LabelFileName.place(x=22, y=85, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=58
    str_tp2 = tkinter.StringVar()  # 绑定变量
    ctrl_tp2 = tkinter.Entry(root, textvariable=str_tp2, font=('宋体', '9'))
    ctrl_tp2.place(x=101, y=85, width=295, height=22)

    ctrl_LabelFileName = tkinter.Label(root, text='图片3', fg='#FF0000', font=('宋体', '10', 'bold', 'underline'))
    ctrl_LabelFileName.place(x=22, y=125, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=58
    str_tp3 = tkinter.StringVar()  # 绑定变量
    ctrl_tp3 = tkinter.Entry(root, textvariable=str_tp3, font=('宋体', '9'))
    ctrl_tp3.place(x=101, y=125, width=295, height=22)
    ctrl_LabelFileName = tkinter.Label(root, text='图片4', fg='#FF0000', font=('宋体', '10', 'bold', 'underline'))
    ctrl_LabelFileName.place(x=22, y=165, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=58
    str_tp4 = tkinter.StringVar()  # 绑定变量
    ctrl_tp4 = tkinter.Entry(root, textvariable=str_tp4, font=('宋体', '9'))
    ctrl_tp4.place(x=101, y=165, width=295, height=22)

    ctrl_LabelFileName = tkinter.Label(root, text='图片5', fg='#FF0000', font=('宋体', '10', 'bold', 'underline'))
    ctrl_LabelFileName.place(x=22, y=205, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=58
    str_tp5 = tkinter.StringVar()  # 绑定变量
    ctrl_tp5 = tkinter.Entry(root, textvariable=str_tp5, font=('宋体', '9'))
    ctrl_tp5.place(x=101, y=205, width=295, height=22)
    pyperclip.copy('')
    print('开始')
    t= threading.Thread(target=dd)
    t.start()
    tt = threading.Thread(target=ok)
    tt.start()


def ok():
    global it,html,res1,gdata,isn
    while True:
        if len(gdata)==0:
            time.sleep(.2)
        else:
            if len(res1)<=len(gdata):
                for i in range(len(gdata)):
                    try:
                        html = re.sub(res1[i], gdata[i], html, count=1)
                        print(i, res1[1], gdata[i])
                    except:
                        pass
                pyperclip.copy(html)
                messagebox.showinfo('提示', '以复制到你的粘贴板,直接粘贴即可~')
                break
        # else:
        #     messagebox.showinfo('错误', '您没有复制到指定张数~~~~~')
        #     return

    # print(html)


def dd():
    global gdata
    ss=len(res1)
    gos= 0
    last_data = None
    gdata=[]
    while True:
        data = getCopyTxet()
        if gos >= ss:
            break
        if data != last_data:
            ifs = 0
            last_data = data
            sdata1 = re.search('http', data)
            if sdata1 != None:
                gdata.append(data)
                gos=gos+1
                if gos==1:
                    str_tp1.set(data)
                if gos==2:
                    str_tp2.set(data)
                if gos == 3:
                    str_tp3.set(data)
                if gos == 4:
                    str_tp4.set(data)
                if gos == 5:
                    str_tp5.set(data)
        time.sleep(0.3)


root = tkinter.Tk()  # 设定窗体变量
root.geometry('451x253')  # 格式('宽x高+x+y')其中x、y为位置
root.title('SVG助手')
root.wm_attributes('-topmost',1)
str_file = tkinter.StringVar()  # 绑定变量
ctrl_file = ttk.Combobox(root, textvariable=str_file, font=('宋体', '9'))
ctrl_file.place(x=101, y=14, width=250, height=18)
ctrl_file['value'] = (ctrllist1)  # 给下拉菜单设定预设值
ctrl_file.current(0)  # 设定第一个值为默认值

ctrl_LabelBlue = tkinter.Label(root, text='选择SVG文件', fg='#0000C0', font=('黑体', '9', 'bold'))
ctrl_LabelBlue.place(x=7, y=14, height=14)  # 考虑到对齐问题,不列入宽度,需要时手动加入 width=79


ctrl_CommandButton4 = tkinter.Button(root, text='打开', font=('宋体', '9'),
                                     command=open)  # 可在括号内加上调用函数部分 ,command=ctrl_CommandButton4_clicked
ctrl_CommandButton4.place(x=360, y=7, width=58, height=29)

root.mainloop()


免费评分

参与人数 10吾爱币 +17 热心值 +7 收起 理由
凋零灬枫叶 + 1 + 1 谢谢@Thanks!
Jackin + 2 + 1 谢谢@Thanks!
catoo1 + 1 热心回复!
yuanshuzhen + 1 + 1 我很赞同!
businiao10000 + 1 + 1 我很赞同!
dsyuan + 1 + 1 谢谢@Thanks!
Rbtl + 1 + 1 我很赞同!
py学徒 + 1 谢谢@Thanks!
yanglinman + 1 谢谢@Thanks!
风之暇想 + 7 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

xiuro 发表于 2023-5-31 21:37
没搞明白干啥的。。。,提取视频图片的吗?感谢分享
jsdhmqh 发表于 2023-6-1 08:00
hesan 发表于 2023-6-1 10:53
pigfish75 发表于 2023-6-1 15:02
135编辑器用的 谢谢楼主
penglou 发表于 2023-6-1 15:33
下载看一下,谢谢
a85401234 发表于 2023-6-1 19:50
感谢分享,谢谢~
awxzw 发表于 2023-6-1 20:18
下载看看,谢谢!
pheige 发表于 2023-6-2 09:19
下载看看,谢谢!
tianwenmingce 发表于 2023-6-2 10:57
这是做什么的
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 提醒:禁止复制他人回复等『恶意灌水』行为,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-26 06:44

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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