猫史档案馆


【Python作品分享】我的文件【作业帖】

用户:随风6ar_随风6ar_查看:0 回复:0 评论:0 创建时间:2022-01-29T23:40:10


【作品展示】

center_image

 

【作品介绍】

1

 

【作品源代码】

import time as t
import easygui
import tkinter as tk
import tkinter
from tkinter import *
import sys
import easygui as e
import tkinter.messagebox
from PIL import Image, ImageTk
import pygame

# 导入pygame资源包

# 开始播放音乐流
a = e.enterbox(msg='请输入创客码.', title='加密与解密', default='', strip=True, image=None, root=None)
a=int(a)
if a == 9999:
    def get_image(filename, width, height):
        im = Image.open(filename).resize((width, height))
        return ImageTk.PhotoImage(im)


    root = Tk()
    root.maxsize(490, 490)  # 左右高
    root.title('加密与解密の个性化版')
    root.resizable(False, False)
    canvas_root = tk.Canvas(root, width=495, height=495)
    im_root = get_image(
        '01d1a75b3484d4a80120b959e7c899.jpg@1280w_1l_2o_100sh.jpg', 490, 495)
    canvas_root.create_image(245, 247, image=im_root)
    canvas_root.pack()


    def cut(event=None):
        e.msgbox('@蒸汽创客张明灿,电话:喵', '关于')


    def copy(event=None):
        e.msgbox('您已完成个性化升级', '个性化')


    def paste(event=None):
        file = r'李雨桐 - 我和我的祖国.mp3'		# 音乐的路径
        pygame.mixer.init()						# 初始化
        track = pygame.mixer.music.load(file)  # 加载音乐文件
        pygame.mixer.music.play()


    def paste1(event=None):
        file = r'李雨桐 - 我和我的祖国.mp3'		# 音乐的路径
        pygame.mixer.init()						# 初始化
        track = pygame.mixer.music.load(file)  # 加载音乐文件
        pygame.mixer.music.pause()


    texteditor = Text(root)
    menubar = Menu(root)
    filemenu = Menu(menubar)
    root.config(menu=menubar)
    filemenu.add_command(label="关于", command=cut)
    filemenu.add_command(label="个性化", command=copy)
    filemenu.add_command(label="播放音乐", command=paste)
    filemenu.add_command(label="停止播放音乐", command=paste1)

    menubar.add_cascade(label="集合", menu=filemenu)


    isencry = False  # 为了防止点击多次加密出现问题
    # 加密算法,参数:秘钥,文本


    def encryption():
        key = inputkey.get()
        global isencry
        if len(key) > 2 and len(key) < 10 and isencry:
            text = inputtext.get(1.0, 'end')
            text2 = ''
        # 将key转化成ascii码列表
            newkey = []
            for i in key:
                newkey.append(ord(i))
            ii = 0
            for i in text:
                if ord(i) != 10:
                    text2 = text2+chr(ord(i)+newkey[ii])  # 关键部分,加密公式
                else:
                    text2 = text2+chr(10)
                ii = ii+1
                if ii >= len(newkey):
                    ii = 0
            inputtext.delete(1.0, 'end')
            inputtext.insert('insert', text2)
        isencry = False
    # 修改文本触发


    def i喵odifytext(*o):
        global isencry
        isencry = True


    tkinter.Label(
        root, text='[-----------------------------------加 密-----------------------------------]', bg='Moccasin').place(x=10, y=0)
    # 设置秘钥
    tkinter.Label(root, text="请您输入9位秘钥", bg='Moccasin').place(x=10, y=30)
    ik = tkinter.StringVar()
    inputkey = tkinter.Entry(root, textvariable=ik, width=36, bg='Moccasin')
    inputkey.place(x=150, y=30)

    # 输入要加密的文本
    tkinter.Label(root, text="请您输入要加密的文本", bg='Moccasin').place(x=10, y=60)
    inputtext = tkinter.Text(root, width=36, height=10, bg='Moccasin')
    inputtext.place(x=150, y=60)
    inputtext.bind('', i喵odifytext)
    # 点击加密
    tkinter.Button(root, text='进行加密', bg='Moccasin', width=14,
                command=encryption).place(x=10, y=198)

    # 解密
    isdecry = False  # 为了防止点击多次解密出现bug
    # 解密算法,参数:秘钥,文本


    def decrypt():
        key = inputkey.get()
        global isdecry
        if len(key) > 2 and len(key) < 10 and isdecry:
            text = inputtext2.get(1.0, 'end')
            text2 = ''
            #将key转化成ascii码列表
            newkey = []
            for i in key:
                newkey.append(ord(i))
            ii = 0
            for i in text:
                if ord(i) != 10:
                    text2 = text2+chr(ord(i)-newkey[ii])  # 关键部分,解密公式
                else:
                    text2 = text2+chr(10)
                ii = ii+1
                if ii >= len(newkey):
                    ii = 0
            inputtext2.delete(1.0, 'end')
            inputtext2.insert('insert', text2)
        isdecry = False
    #修改文本触发


    def i喵odify2(*o):
        global isdecry
        isdecry = True


    tkinter.Label(
        root, text='[-----------------------------------解 密-----------------------------------]', bg='Moccasin').place(x=10, y=250)
    # 设置秘钥
    tkinter.Label(root, text="请您输入9位秘钥", bg='Moccasin').place(x=10, y=280)
    ik2 = tkinter.StringVar()
    inpurootey2 = tkinter.Entry(root, textvariable=ik2, width=36, bg='Moccasin')
    inpurootey2.place(x=150, y=280)
    # 输入要解密的文本
    tkinter.Label(root, text="请您输入要解密的文本", bg='Moccasin').place(x=10, y=310)
    inputtext2 = tkinter.Text(root, width=36, height=10, bg='Moccasin')
    inputtext2.place(x=150, y=310)
    inputtext2.bind('', i喵odify2)
    # 点击解密
    tkinter.Button(root, text='进行解密', bg='Moccasin', width=14,
                command=decrypt).place(x=10, y=448)


    root.mainloop()  # 显示窗口
elif a==8888:
    root = Tk()
    root.minsize(490, 495)
    root.maxsize(490, 495)
    root.title('加密与解密(企业版)')


    def cut(event=None):
        e.msgbox('@蒸汽创客张明灿,电话:喵', '关于')


    def copy(event=None):
        e.msgbox('以下是效果:购买请拨打喵', '好的', image='')


    def paste(event=None):
        e.msgbox('请您致电喵', '意见')


    texteditor = Text(root)
    menubar = Menu(root)
    filemenu = Menu(menubar)
    root.config(menu=menubar)
    filemenu.add_command(label="关于", command=cut)
    filemenu.add_command(label="个性化", command=copy)
    filemenu.add_command(label="意见", command=paste)
    menubar.add_cascade(label="集合", menu=filemenu)


    isencry = False  # 为了防止点击多次加密出现问题
    # 加密算法,参数:秘钥,文本


    def encryption():
        key = inputkey.get()
        global isencry
        if len(key) > 2 and len(key) < 10 and isencry:
            text = inputtext.get(1.0, 'end')
            text2 = ''
            # 将key转化成ascii码列表
            newkey = []
            for i in key:
                newkey.append(ord(i))
            ii = 0
            for i in text:
                if ord(i) != 10:
                    text2 = text2+chr(ord(i)+newkey[ii])  # 关键部分,加密公式
                else:
                    text2 = text2+chr(10)
                ii = ii+1
                if ii >= len(newkey):
                    ii = 0
            inputtext.delete(1.0, 'end')
            inputtext.insert('insert', text2)
        isencry = False
    # 修改文本触发


    def i喵odifytext(*o):
        global isencry
        isencry = True


    tkinter.Label(
        root, text='------------------------------------加 密------------------------------------').place(x=10, y=0)
    # 设置秘钥
    tkinter.Label(root, text="请您输入6-9位的秘钥").place(x=10, y=30)
    ik = tkinter.StringVar()
    inputkey = tkinter.Entry(root, textvariable=ik, width=36)
    inputkey.place(x=150, y=30)

    # 输入要加密的文本
    tkinter.Label(root, text="请您输入要加密的文本").place(x=10, y=60)
    inputtext = tkinter.Text(root, width=36, height=10)
    inputtext.place(x=150, y=60)
    inputtext.bind('', i喵odifytext)
    # 点击加密
    tkinter.Button(root, text='点击加密', width=14,
                command=encryption).place(x=10, y=198)

    # 解密
    isdecry = False  # 为了防止点击多次解密出现bug
    # 解密算法,参数:秘钥,文本


    def decrypt():
        key = inputkey.get()
        global isdecry
        if len(key) > 2 and len(key) < 10 and isdecry:
            text = inputtext2.get(1.0, 'end')
            text2 = ''
            #将key转化成ascii码列表
            newkey = []
            for i in key:
                newkey.append(ord(i))
            ii = 0
            for i in text:
                if ord(i) != 10:
                    text2 = text2+chr(ord(i)-newkey[ii])  # 关键部分,解密公式
                else:
                    text2 = text2+chr(10)
                ii = ii+1
                if ii >= len(newkey):
                    ii = 0
            inputtext2.delete(1.0, 'end')
            inputtext2.insert('insert', text2)
        isdecry = False
    #修改文本触发


    def i喵odify2(*o):
        global isdecry
        isdecry = True


    tkinter.Label(
        root, text='------------------------------------解 密------------------------------------').place(x=10, y=250)
    # 设置秘钥
    tkinter.Label(root, text="请您输入6-9位的秘钥").place(x=10, y=280)
    ik2 = tkinter.StringVar()
    inpurootey2 = tkinter.Entry(root, textvariable=ik2, width=36)
    inpurootey2.place(x=150, y=280)
    # 输入要解密的文本
    tkinter.Label(root, text="请您输入要解密的文本").place(x=10, y=310)
    inputtext2 = tkinter.Text(root, width=36, height=10)
    inputtext2.place(x=150, y=310)
    inputtext2.bind('', i喵odify2)
    # 点击解密
    tkinter.Button(root, text='点击解密', width=14,
                command=decrypt).place(x=10, y=448)


    root.mainloop()  # 显示窗口
elif a==7777:
    tk = tkinter .Tk()  # line:2
    tk .minsize(460, 495)  # line:3
    tk .maxsize(490, 495)  # line:4
    tk .title('个人版')  # line:5
    isencry = False  # line:8


    def encryption():  # line:12
        OO0O0O00000OOO000 = inputkey .get()  # line:13
        global isencry  # line:14
        if len(OO0O0O00000OOO000) > 2 and len(OO0O0O00000OOO000) < 10 and isencry:  # line:15
            OO00OO0OOOO0O0000 = inputtext .get(1.0, 'end')  # line:16
            O0OO00OO0O00OO0OO = ''  # line:17
            OOOOO00OO00000OOO = []  # line:19
            for O0O0O000O0OO0O00O in OO0O0O00000OOO000:  # line:20
                OOOOO00OO00000OOO .append(ord(O0O0O000O0OO0O00O))  # line:21
            O000O0OO0O0000O0O = 0  # line:22
            for O0O0O000O0OO0O00O in OO00OO0OOOO0O0000:  # line:23
                if ord(O0O0O000O0OO0O00O) != 10:  # line:24
                    O0OO00OO0O00OO0OO = O0OO00OO0O00OO0OO + \
                        chr(ord(O0O0O000O0OO0O00O) +
                            OOOOO00OO00000OOO[O000O0OO0O0000O0O])  # line:25
                else:  # line:26
                    O0OO00OO0O00OO0OO = O0OO00OO0O00OO0OO + chr(10)  # line:27
                O000O0OO0O0000O0O = O000O0OO0O0000O0O + 1  # line:28
                if O000O0OO0O0000O0O >= len(OOOOO00OO00000OOO):  # line:29
                    O000O0OO0O0000O0O = 0  # line:30
            inputtext .delete(1.0, 'end')  # line:31
            inputtext .insert('insert', O0OO00OO0O00OO0OO)  # line:32
        isencry = False  # line:33


    def i喵odifytext(*O00O00OO00OOOOO0O):  # line:37
        global isencry  # line:38
        isencry = True  # line:39


    tkinter .Label(
        tk, text='加 密').place(x=10, y=0)  # line:43
    tkinter .Label(tk, text="秘钥").place(x=10, y=30)  # line:47
    ik = tkinter .StringVar()  # line:48
    inputkey = tkinter .Entry(tk, textvariable=ik, width=36)  # line:49
    inputkey .place(x=150, y=30)  # line:50
    tkinter .Label(tk, text="文本").place(x=10, y=60)  # line:54
    inputtext = tkinter .Text(tk, width=36, height=10)  # line:55
    inputtext .place(x=150, y=60)  # line:56
    inputtext .bind('', i喵odifytext)  # line:57
    tkinter .Button(tk, text='加密', width=14, command=encryption).place(
        x=10, y=198)  # line:62
    isdecry = False  # line:66


    def decrypt():  # line:70
        O000OO000OO00OO0O = inputkey2 .get()  # line:71
        global isdecry  # line:72
        if len(O000OO000OO00OO0O) > 2 and len(O000OO000OO00OO0O) < 10 and isdecry:  # line:73
            O000OO0O0O00OO0O0 = inputtext2 .get(1.0, 'end')  # line:74
            OOO00O000OOOO0OOO = ''  # line:75
            O000O00O000OO00O0 = []  # line:77
            for OOOO0OOO0O000OO0O in O000OO000OO00OO0O:  # line:78
                O000O00O000OO00O0 .append(ord(OOOO0OOO0O000OO0O))  # line:79
            O00OOO0O00O00O00O = 0  # line:80
            for OOOO0OOO0O000OO0O in O000OO0O0O00OO0O0:  # line:81
                if ord(OOOO0OOO0O000OO0O) != 10:  # line:82
                    OOO00O000OOOO0OOO = OOO00O000OOOO0OOO + \
                        chr(ord(OOOO0OOO0O000OO0O) -
                            O000O00O000OO00O0[O00OOO0O00O00O00O])  # line:83
                else:  # line:84
                    OOO00O000OOOO0OOO = OOO00O000OOOO0OOO + chr(10)  # line:85
                O00OOO0O00O00O00O = O00OOO0O00O00O00O + 1  # line:86
                if O00OOO0O00O00O00O >= len(O000O00O000OO00O0):  # line:87
                    O00OOO0O00O00O00O = 0  # line:88
            inputtext2 .delete(1.0, 'end')  # line:89
            inputtext2 .insert('insert', OOO00O000OOOO0OOO)  # line:90
        isdecry = False  # line:91


    def i喵odify2(*OOO0OO0OOO0000OO0):  # line:98
        global isdecry  # line:99
        isdecry = True  # line:100


    tkinter .Label(
        tk, text='解 密').place(x=10, y=250)  # line:105
    tkinter .Label(tk, text="秘钥").place(x=10, y=280)  # line:109
    ik2 = tkinter .StringVar()  # line:110
    inputkey2 = tkinter .Entry(tk, textvariable=ik2, width=36)  # line:111
    inputkey2 .place(x=150, y=280)  # line:112
    tkinter .Label(tk, text="文本").place(x=10, y=310)  # line:116
    inputtext2 = tkinter .Text(tk, width=36, height=10)  # line:117
    inputtext2 .place(x=150, y=310)  # line:118
    inputtext2 .bind('', i喵odify2)  # line:119
    tkinter .Button(tk, text='解密', width=14, command=decrypt).place(
        x=10, y=448)  # line:123

    for i in range(1, 4):
        t.sleep(1)
    tk .mainloop()  # line:126
else:
    while True:
        e.msgbox('输入无效','加密与解密','好的')
        a = e.enterbox(msg='请输入创客码.', title='加密与解密', default='',
                       strip=True, image=None, root=None)
        a=int(a)
        if a == 9999:
            def get_image(filename, width, height):
                im = Image.open(filename).resize((width, height))
                return ImageTk.PhotoImage(im)

            root = Tk()
            root.maxsize(490, 490)  # 左右高
            root.title('加密与解密の个性化版')
            root.resizable(False, False)
            canvas_root = tk.Canvas(root, width=495, height=495)
            im_root = get_image(
                '01d1a75b3484d4a80120b959e7c899.jpg@1280w_1l_2o_100sh.jpg', 490, 495)
            canvas_root.create_image(245, 247, image=im_root)
            canvas_root.pack()

            def cut(event=None):
                e.msgbox('@蒸汽创客张明灿,电话:喵', '关于')

            def copy(event=None):
                e.msgbox('您已完成个性化升级', '个性化')

            def paste(event=None):
                file = r'李雨桐 - 我和我的祖国.mp3'		# 音乐的路径
                pygame.mixer.init()						# 初始化
                track = pygame.mixer.music.load(file)  # 加载音乐文件
                pygame.mixer.music.play()

            def paste1(event=None):
                file = r'李雨桐 - 我和我的祖国.mp3'		# 音乐的路径
                pygame.mixer.init()						# 初始化
                track = pygame.mixer.music.load(file)  # 加载音乐文件
                pygame.mixer.music.pause()

            texteditor = Text(root)
            menubar = Menu(root)
            filemenu = Menu(menubar)
            root.config(menu=menubar)
            filemenu.add_command(label="关于", command=cut)
            filemenu.add_command(label="个性化", command=copy)
            filemenu.add_command(label="播放音乐", command=paste)
            filemenu.add_command(label="停止播放音乐", command=paste1)

            menubar.add_cascade(label="集合", menu=filemenu)

            isencry = False  # 为了防止点击多次加密出现问题
            # 加密算法,参数:秘钥,文本

            def encryption():
                key = inputkey.get()
                global isencry
                if len(key) > 2 and len(key) < 10 and isencry:
                    text = inputtext.get(1.0, 'end')
                    text2 = ''
                # 将key转化成ascii码列表
                    newkey = []
                    for i in key:
                        newkey.append(ord(i))
                    ii = 0
                    for i in text:
                        if ord(i) != 10:
                            text2 = text2+chr(ord(i)+newkey[ii])  # 关键部分,加密公式
                        else:
                            text2 = text2+chr(10)
                        ii = ii+1
                        if ii >= len(newkey):
                            ii = 0
                    inputtext.delete(1.0, 'end')
                    inputtext.insert('insert', text2)
                isencry = False
            # 修改文本触发

            def i喵odifytext(*o):
                global isencry
                isencry = True

            tkinter.Label(
                root, text='[-----------------------------------加 密-----------------------------------]', bg='Moccasin').place(x=10, y=0)
            # 设置秘钥
            tkinter.Label(root, text="请您输入9位秘钥", bg='Moccasin').place(x=10, y=30)
            ik = tkinter.StringVar()
            inputkey = tkinter.Entry(root, textvariable=ik, width=36, bg='Moccasin')
            inputkey.place(x=150, y=30)

            # 输入要加密的文本
            tkinter.Label(root, text="请您输入要加密的文本", bg='Moccasin').place(x=10, y=60)
            inputtext = tkinter.Text(root, width=36, height=10, bg='Moccasin')
            inputtext.place(x=150, y=60)
            inputtext.bind('', i喵odifytext)
            # 点击加密
            tkinter.Button(root, text='进行加密', bg='Moccasin', width=14,
                        command=encryption).place(x=10, y=198)

            # 解密
            isdecry = False  # 为了防止点击多次解密出现bug
            # 解密算法,参数:秘钥,文本

            def decrypt():
                key = inputkey.get()
                global isdecry
                if len(key) > 2 and len(key) < 10 and isdecry:
                    text = inputtext2.get(1.0, 'end')
                    text2 = ''
                    #将key转化成ascii码列表
                    newkey = []
                    for i in key:
                        newkey.append(ord(i))
                    ii = 0
                    for i in text:
                        if ord(i) != 10:
                            text2 = text2+chr(ord(i)-newkey[ii])  # 关键部分,解密公式
                        else:
                            text2 = text2+chr(10)
                        ii = ii+1
                        if ii >= len(newkey):
                            ii = 0
                    inputtext2.delete(1.0, 'end')
                    inputtext2.insert('insert', text2)
                isdecry = False
            #修改文本触发

            def i喵odify2(*o):
                global isdecry
                isdecry = True

            tkinter.Label(
                root, text='[-----------------------------------解 密-----------------------------------]', bg='Moccasin').place(x=10, y=250)
            # 设置秘钥
            tkinter.Label(root, text="请您输入9位秘钥", bg='Moccasin').place(x=10, y=280)
            ik2 = tkinter.StringVar()
            inpurootey2 = tkinter.Entry(
                root, textvariable=ik2, width=36, bg='Moccasin')
            inpurootey2.place(x=150, y=280)
            # 输入要解密的文本
            tkinter.Label(root, text="请您输入要解密的文本", bg='Moccasin').place(x=10, y=310)
            inputtext2 = tkinter.Text(root, width=36, height=10, bg='Moccasin')
            inputtext2.place(x=150, y=310)
            inputtext2.bind('', i喵odify2)
            # 点击解密
            tkinter.Button(root, text='进行解密', bg='Moccasin', width=14,
                        command=decrypt).place(x=10, y=448)

            root.mainloop()  # 显示窗口
            break
        elif a == 8888:
            root = Tk()
            root.minsize(490, 495)
            root.maxsize(490, 495)
            root.title('加密与解密(企业版)')

            def cut(event=None):
                e.msgbox('@蒸汽创客张明灿,电话:喵', '关于')

            def copy(event=None):
                e.msgbox('以下是效果:购买请拨打喵', '好的', image='')

            def paste(event=None):
                e.msgbox('请您致电喵', '意见')

            texteditor = Text(root)
            menubar = Menu(root)
            filemenu = Menu(menubar)
            root.config(menu=menubar)
            filemenu.add_command(label="关于", command=cut)
            filemenu.add_command(label="个性化", command=copy)
            filemenu.add_command(label="意见", command=paste)
            menubar.add_cascade(label="集合", menu=filemenu)

            isencry = False  # 为了防止点击多次加密出现问题
            # 加密算法,参数:秘钥,文本

            def encryption():
                key = inputkey.get()
                global isencry
                if len(key) > 2 and len(key) < 10 and isencry:
                    text = inputtext.get(1.0, 'end')
                    text2 = ''
                    # 将key转化成ascii码列表
                    newkey = []
                    for i in key:
                        newkey.append(ord(i))
                    ii = 0
                    for i in text:
                        if ord(i) != 10:
                            text2 = text2+chr(ord(i)+newkey[ii])  # 关键部分,加密公式
                        else:
                            text2 = text2+chr(10)
                        ii = ii+1
                        if ii >= len(newkey):
                            ii = 0
                    inputtext.delete(1.0, 'end')
                    inputtext.insert('insert', text2)
                isencry = False
            # 修改文本触发

            def i喵odifytext(*o):
                global isencry
                isencry = True

            tkinter.Label(
                root, text='------------------------------------加 密------------------------------------').place(x=10, y=0)
            # 设置秘钥
            tkinter.Label(root, text="请您输入6-9位的秘钥").place(x=10, y=30)
            ik = tkinter.StringVar()
            inputkey = tkinter.Entry(root, textvariable=ik, width=36)
            inputkey.place(x=150, y=30)

            # 输入要加密的文本
            tkinter.Label(root, text="请您输入要加密的文本").place(x=10, y=60)
            inputtext = tkinter.Text(root, width=36, height=10)
            inputtext.place(x=150, y=60)
            inputtext.bind('', i喵odifytext)
            # 点击加密
            tkinter.Button(root, text='点击加密', width=14,
                        command=encryption).place(x=10, y=198)

            # 解密
            isdecry = False  # 为了防止点击多次解密出现bug
            # 解密算法,参数:秘钥,文本

            def decrypt():
                key = inputkey.get()
                global isdecry
                if len(key) > 2 and len(key) < 10 and isdecry:
                    text = inputtext2.get(1.0, 'end')
                    text2 = ''
                    #将key转化成ascii码列表
                    newkey = []
                    for i in key:
                        newkey.append(ord(i))
                    ii = 0
                    for i in text:
                        if ord(i) != 10:
                            text2 = text2+chr(ord(i)-newkey[ii])  # 关键部分,解密公式
                        else:
                            text2 = text2+chr(10)
                        ii = ii+1
                        if ii >= len(newkey):
                            ii = 0
                    inputtext2.delete(1.0, 'end')
                    inputtext2.insert('insert', text2)
                isdecry = False
            #修改文本触发

            def i喵odify2(*o):
                global isdecry
                isdecry = True

            tkinter.Label(
                root, text='------------------------------------解 密------------------------------------').place(x=10, y=250)
            # 设置秘钥
            tkinter.Label(root, text="请您输入6-9位的秘钥").place(x=10, y=280)
            ik2 = tkinter.StringVar()
            inpurootey2 = tkinter.Entry(root, textvariable=ik2, width=36)
            inpurootey2.place(x=150, y=280)
            # 输入要解密的文本
            tkinter.Label(root, text="请您输入要解密的文本").place(x=10, y=310)
            inputtext2 = tkinter.Text(root, width=36, height=10)
            inputtext2.place(x=150, y=310)
            inputtext2.bind('', i喵odify2)
            # 点击解密
            tkinter.Button(root, text='点击解密', width=14,
                        command=decrypt).place(x=10, y=448)

            root.mainloop()
            break  # 显示窗口
        elif a == 7777:
            tk = tkinter .Tk()  # line:2
            tk .minsize(460, 495)  # line:3
            tk .maxsize(490, 495)  # line:4
            tk .title('个人版')  # line:5
            isencry = False  # line:8

            def encryption():  # line:12
                OO0O0O00000OOO000 = inputkey .get()  # line:13
                global isencry  # line:14
                if len(OO0O0O00000OOO000) > 2 and len(OO0O0O00000OOO000) < 10 and isencry:  # line:15
                    OO00OO0OOOO0O0000 = inputtext .get(1.0, 'end')  # line:16
                    O0OO00OO0O00OO0OO = ''  # line:17
                    OOOOO00OO00000OOO = []  # line:19
                    for O0O0O000O0OO0O00O in OO0O0O00000OOO000:  # line:20
                        OOOOO00OO00000OOO .append(ord(O0O0O000O0OO0O00O))  # line:21
                    O000O0OO0O0000O0O = 0  # line:22
                    for O0O0O000O0OO0O00O in OO00OO0OOOO0O0000:  # line:23
                        if ord(O0O0O000O0OO0O00O) != 10:  # line:24
                            O0OO00OO0O00OO0OO = O0OO00OO0O00OO0OO + \
                                chr(ord(O0O0O000O0OO0O00O) +
                                    OOOOO00OO00000OOO[O000O0OO0O0000O0O])  # line:25
                        else:  # line:26
                            O0OO00OO0O00OO0OO = O0OO00OO0O00OO0OO + chr(10)  # line:27
                        O000O0OO0O0000O0O = O000O0OO0O0000O0O + 1  # line:28
                        if O000O0OO0O0000O0O >= len(OOOOO00OO00000OOO):  # line:29
                            O000O0OO0O0000O0O = 0  # line:30
                    inputtext .delete(1.0, 'end')  # line:31
                    inputtext .insert('insert', O0OO00OO0O00OO0OO)  # line:32
                isencry = False  # line:33

            def i喵odifytext(*O00O00OO00OOOOO0O):  # line:37
                global isencry  # line:38
                isencry = True  # line:39

            tkinter .Label(
                tk, text='加 密').place(x=10, y=0)  # line:43
            tkinter .Label(tk, text="秘钥").place(x=10, y=30)  # line:47
            ik = tkinter .StringVar()  # line:48
            inputkey = tkinter .Entry(tk, textvariable=ik, width=36)  # line:49
            inputkey .place(x=150, y=30)  # line:50
            tkinter .Label(tk, text="文本").place(x=10, y=60)  # line:54
            inputtext = tkinter .Text(tk, width=36, height=10)  # line:55
            inputtext .place(x=150, y=60)  # line:56
            inputtext .bind('', i喵odifytext)  # line:57
            tkinter .Button(tk, text='加密', width=14, command=encryption).place(
                  x=10, y=198)  # line:62
            isdecry = False  # line:66

            def decrypt():  # line:70
                O000OO000OO00OO0O = inputkey2 .get()  # line:71
                global isdecry  # line:72
                if len(O000OO000OO00OO0O) > 2 and len(O000OO000OO00OO0O) < 10 and isdecry:  # line:73
                    O000OO0O0O00OO0O0 = inputtext2 .get(1.0, 'end')  # line:74
                    OOO00O000OOOO0OOO = ''  # line:75
                    O000O00O000OO00O0 = []  # line:77
                    for OOOO0OOO0O000OO0O in O000OO000OO00OO0O:  # line:78
                        O000O00O000OO00O0 .append(ord(OOOO0OOO0O000OO0O))  # line:79
                    O00OOO0O00O00O00O = 0  # line:80
                    for OOOO0OOO0O000OO0O in O000OO0O0O00OO0O0:  # line:81
                        if ord(OOOO0OOO0O000OO0O) != 10:  # line:82
                            OOO00O000OOOO0OOO = OOO00O000OOOO0OOO + \
                                chr(ord(OOOO0OOO0O000OO0O) -
                                    O000O00O000OO00O0[O00OOO0O00O00O00O])  # line:83
                        else:  # line:84
                            OOO00O000OOOO0OOO = OOO00O000OOOO0OOO + chr(10)  # line:85
                        O00OOO0O00O00O00O = O00OOO0O00O00O00O + 1  # line:86
                        if O00OOO0O00O00O00O >= len(O000O00O000OO00O0):  # line:87
                            O00OOO0O00O00O00O = 0  # line:88
                    inputtext2 .delete(1.0, 'end')  # line:89
                    inputtext2 .insert('insert', OOO00O000OOOO0OOO)  # line:90
                isdecry = False  # line:91

            def i喵odify2(*OOO0OO0OOO0000OO0):  # line:98
                global isdecry  # line:99
                isdecry = True  # line:100

            tkinter .Label(
                tk, text='解 密').place(x=10, y=250)  # line:105
            tkinter .Label(tk, text="秘钥").place(x=10, y=280)  # line:109
            ik2 = tkinter .StringVar()  # line:110
            inputkey2 = tkinter .Entry(tk, textvariable=ik2, width=36)  # line:111
            inputkey2 .place(x=150, y=280)  # line:112
            tkinter .Label(tk, text="文本").place(x=10, y=310)  # line:116
            inputtext2 = tkinter .Text(tk, width=36, height=10)  # line:117
            inputtext2 .place(x=150, y=310)  # line:118
            inputtext2 .bind('', i喵odify2)  # line:119
            tkinter .Button(tk, text='解密', width=14, command=decrypt).place(
                x=10, y=448)  # line:123

            for i in range(1, 4):
                t.sleep(1)
            tk .mainloop()
            break  # line:126

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页