import tkinter as tk
from tkinter import *
import base64
window=tk.Tk()
window.title('base64生成解密程序')
window.geometry('800x600')
labeltext="请在下面输入要加密的字符串\n注意:换行符、头尾空格会被自动去除!"
textLabel = Label(window, text=labeltext, bg = 'red',fg = 'black' , justify=LEFT)
textLabel.pack(side=TOP)
t0=tk.Text(window,height=20)
t0.pack()
def make():
var=t0.get("0.0", "end")
res=""
allres=""
for i in var:
res = res + i
if (i == '\n'):
allres = allres + res.strip().replace("\n", "")
res=""
t.config(state=NORMAL)
t.delete("0.0", "end")
t.insert('insert',"生成的密码:[" + bytes.decode(base64.b64encode(bytes(allres, encoding="utf8"))) + "]")
t.config(state=DISABLED)
t3.config(state=NORMAL)
t3.delete("0.0", "end")
t3.insert('insert', "格式化后的字符串:["+allres +"]")
t3.config(state=DISABLED)
def clear():
var = t0.get("0.0", "end")
t0.delete("0.0", "end")
t.config(state=NORMAL)
t.delete("0.0", "end")
t.config(state=DISABLED)
t3.config(state=NORMAL)
t3.delete("0.0", "end")
t3.config(state=DISABLED)
t3=tk.Text(window,height=10,bg="#AD58E6")
t3.pack(side = TOP)
t=tk.Text(window,height=10,bg="#ADD8E6")
t.pack(side = TOP)
frame1 = Frame(window)
frame1.pack(side = TOP)
b1=tk.Button(frame1,text='生成密码',width=10,height=2,command=make)
b1.pack(side=RIGHT)
b2=tk.Button(frame1,text='清空所有',width=10,height=2,command=clear)
b2.pack(side=LEFT)
window.mainloop()
import tkinter as tk
from tkinter import *
import base64
window=tk.Tk()
window.title('base64生成解密程序')
window.geometry('800x600')
labeltext="请在下面输入要解密的字符串\n注意:换行符、头尾空格会被自动去除!"
textLabel = Label(window, text=labeltext, bg = 'red',fg = 'black' , justify=LEFT)
textLabel.pack(side=TOP)
t0=tk.Text(window,height=20)
t0.pack()
def make():
var=t0.get("0.0", "end")
res = ""
allres = ""
for i in var:
res = res + i
if (i == '\n'):
allres = allres + res.strip().replace("\n", "")
res = ""
t.config(state=NORMAL)
t.delete("0.0", "end")
t.insert('insert',"解密后的字符串:[" + bytes.decode(base64.b64decode(bytes(allres, encoding="utf8"))) + "]")
t.config(state=DISABLED)
def clear():
var = t0.get("0.0", "end")
t0.delete("0.0", "end")
t.config(state=NORMAL)
t.delete("0.0", "end")
t.config(state=DISABLED)
t=tk.Text(window,height=10,bg="#ADD8E6")
t.pack(side = TOP)
frame1 = Frame(window)
frame1.pack(side = TOP)
b1=tk.Button(frame1,text='解密',width=10,height=2,command=make)
b1.pack(side=RIGHT)
b2=tk.Button(frame1,text='清空所有',width=10,height=2,command=clear)
b2.pack(side=LEFT)
window.mainloop()