-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainUI.py
More file actions
78 lines (63 loc) · 3.13 KB
/
Copy pathmainUI.py
File metadata and controls
78 lines (63 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import tkinter as tk
import ALG
import EncryptorUI
import DecryptorUI
from tkinter import filedialog
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title("「位移加密法」加解密器")
self.geometry("450x300")
self.current_frame = None
self.switch_frame(StartPage)
def switch_frame(self, frame_class):
new_frame = frame_class(self)
if self.current_frame is not None:
self.current_frame.destroy()
self.current_frame = new_frame
self.current_frame.pack()
class StartPage(tk.Frame):
def __init__(self, master):
super().__init__(master)
def hits0() :
DecryptorUI.DQer0()
def hits1() :
DecryptorUI.info0()
def hits2() :
DecryptorUI.DQer1()
def hits3() :
DecryptorUI.info1()
def hits4() :
DecryptorUI.DQer2()
def hits5() :
DecryptorUI.info2()
tk.Label(self, text = "解密器", padx = 40, pady = 15, font = ('Times New Roman', 15, 'bold')).grid(row = 0, column = 1)
tk.Button(self, text = "加密器", padx = 40, pady = 15, command = lambda: master.switch_frame(PageOne)).grid(row = 0, column = 0)
tk.Button(self, text = "字典法解密", padx = 30, pady = 10, command = hits0).grid(row = 2, column = 1)
tk.Button(self, text = "原理->", padx = 10, pady = 10, command = hits1).grid(row = 2, column = 0)
tk.Button(self, text = "單字頻數法解密", padx = 15, pady = 10, command = hits2).grid(row = 3, column = 1)
tk.Button(self, text = "原理->", padx = 10, pady = 10, command = hits3).grid(row = 3, column = 0)
tk.Button(self, text = "序列編號加密法解密", padx = 15, pady = 10, command = hits4).grid(row = 4, column = 1)
tk.Button(self, text = "原理->", padx = 10, pady = 10, command = hits5).grid(row = 4, column = 0)
tk.Label(self, text = " ", padx = 40, pady = 15).grid(row = 1)
class PageOne(tk.Frame):
def __init__(self, master):
super().__init__(master)
def hits0() :
EncryptorUI.EQer0()
def hits1() :
EncryptorUI.info0()
def hits2() :
EncryptorUI.EQer1()
def hits3() :
EncryptorUI.info1()
tk.Label(self, text = "加密器", padx = 40, pady = 15, font = ('Times New Roman', 15, 'bold')).grid(row = 0, column = 0)
tk.Button(self, text = "解密器", padx = 40, pady = 15, command = lambda: master.switch_frame(StartPage)).grid(row = 0, column = 1)
tk.Label(self, text = " ", padx = 40, pady = 15).grid(row = 1)
tk.Button(self, text = "位移方法加密", padx = 30, pady = 10, command = hits0).grid(row = 2, column = 0)
tk.Button(self, text = "<-原理", padx = 10, pady = 10, command = hits1).grid(row = 2, column = 1)
tk.Button(self, text = "序列編號加密法加密", padx = 30, pady = 10, command = hits2).grid(row = 3, column = 0)
tk.Button(self, text = "<-原理", padx = 10, pady = 10, command = hits3).grid(row = 3, column = 1)
if __name__ == "__main__":
app = App()
app.mainloop()