47 lines
2.3 KiB
Python
47 lines
2.3 KiB
Python
#path
|
|
import tkinter as tk
|
|
dictionary = {'0000': '0', '0001': '1', '0002': '2', '0003': '3', '0004': '4', '0005': '5', '0006': '6', '0007': '7', '0008': '8', '0009': '9', '0010': 'a', '0011': 'b', '0012': 'c', '0013': 'd', '0014': 'e', '0015': 'f', '0016': 'g', '0017': 'h', '0018': 'i', '0019': 'j', '0020': 'k', '0021': 'l', '0022': 'm', '0023': 'n', '0024': 'o', '0025': 'p', '0026': 'q', '0027': 'r', '0028': 's', '0029': 't', '0030': 'u', '0031': 'v', '0032': 'w', '0033': 'x', '0034': 'y', '0035': 'z', '0036': 'A', '0037': 'B', '0038': 'C', '0039': 'D', '0040': 'E', '0041': 'F', '0042': 'G', '0043': 'H', '0044': 'I', '0045': 'J', '0046': 'K', '0047': 'L', '0048': 'M', '0049': 'N', '0050': 'O', '0051': 'P', '0052': 'Q', '0053': 'R', '0054': 'S', '0055': 'T', '0056': 'U', '0057': 'V', '0058': 'W', '0059': 'X', '0060': 'Y', '0061': 'Z', '0062': '!', '0063': '"', '0064': '#', '0065': '$', '0066': '%', '0067': '&', '0068': "'", '0069': '(', '0070': ')', '0071': '*', '0072': '+', '0073': ',', '0074': '-', '0075': '.', '0076': '/', '0077': ':', '0078': ';', '0079': '<', '0080': '=', '0081': '>', '0082': '?', '0083': '@', '0084': '[', '0085': '\\', '0086': ']', '0087': '^', '0088': '_', '0089': '`', '0090': '{', '0091': '|', '0092': '}', '0093': '~', '0094': ' ', '0095': '\t', '0096': '\n', '0097': '\r', '0098': '\x0b', '0099': '\x0c'}
|
|
def totext():
|
|
out = ""
|
|
temp = open(path, 'r')
|
|
temp = temp.read()
|
|
for i in range(0, len(temp), 4):
|
|
temp2 = temp[i]
|
|
temp2 = temp2+temp[i+1]
|
|
temp2 = temp2+temp[i+2]
|
|
temp2 = temp2+temp[i+3]
|
|
if temp2 in dictionary:
|
|
out = out + dictionary[temp2]
|
|
return out
|
|
|
|
def tonormal(text):
|
|
dictionary2 = {}
|
|
for i in dictionary:
|
|
dictionary2[dictionary[i]] = i
|
|
out = ""
|
|
for i in text:
|
|
out = out + dictionary2[i]
|
|
temp = open(path, 'w')
|
|
temp.write(out)
|
|
temp.close()
|
|
|
|
def save():
|
|
text = label.get("1.0", tk.END)
|
|
tonormal(text)
|
|
|
|
container = tk.Tk("editor")
|
|
temp = totext()
|
|
scrollbar = tk.Scrollbar(container)
|
|
scrollbar.grid(row=0, column=1)
|
|
label = tk.Text(container, yscrollcommand=scrollbar.set)
|
|
label.insert(tk.INSERT, temp)
|
|
label.grid(row=0, column=0)
|
|
scrollbar.config(command=label.yview)
|
|
savebutton = tk.Button(container, text="speichern", command=save)
|
|
savebutton.grid()
|
|
container.mainloop()
|
|
|
|
|
|
|
|
|