猫史档案馆


【Python作品分享】加密与解密2.0【GUI版】【作品秀】

用户:锦廷锦廷查看:0 回复:1 评论:0 创建时间:2022-08-24T11:28:57


【作品展示】

center_image

 

【作品介绍】

将加密与解密更人性化

 

【作品源代码】

from tkinter import*
w=Tk()
w.title('加密与解密')
w.geometry('600x300')
def encode():
    txt0=t0.get(1.0,'end')
    txt0=txt0.rstrip()
    t1=''
    pg=int(e_mp.get())
    for i in txt0:
        co=ord(i)+pg
        w=chr(co)
        t1=t1+w
    t0.delete(1.0,'end')
    t0.insert(1.0,t1)
    b_e['state']='disabled'
    b_J['state']='normal'

def DJIEncode():
    txt0 = t0.get(1.0, 'end')
    txt0 = txt0.rstrip()
    t1 = ''
    pg = int(e_mp.get())
    for i in txt0:
        co = ord(i)-pg
        w = chr(co)
        t1 = t1+w
    t0.delete(1.0, 'end')
    t0.insert(1.0, t1)
    b_e['state'] = 'normal'
    b_J['state'] = 'disabled'


l_password = Label(w, text='密码')
e_mp = Entry(w, width=10, show='*')
b_e=Button(w,text='加密',width=10,command=encode)
b_J = Button(w, text='解密', width=10, command=DJIEncode)
t0 = Text(w, width=85, height=20)

l_password.grid(row=0,column=0)
e_mp.grid(row=0, column=1,sticky=N)
b_e.grid(row=0, column=2)
b_J.grid(row=0, column=3)
t0.grid(row=1, column=0,columnspan=4)
w.mainloop()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
EUWEUW

不如我的 https://shequ.codemao.cn/community/1626931

点赞0


评论