浏览代码

批量进行PEP8整理

Huan 5 年之前
父节点
当前提交
f9fa997e79
共有 20 个文件被更改,包括 12379 次插入3713 次删除
  1. 1 1
      .gitignore
  2. 186 67
      CGB/TK.py
  3. 41 15
      CGB/TK_DoneHS.py
  4. 180 50
      CGB/TK_HS.py
  5. 325 204
      CGB/Write.py
  6. 384 232
      Crawler/Crawler_controller.py
  7. 30 22
      Crawler/Information_storage.py
  8. 2454 551
      Crawler/Web_Crawler.py
  9. 261 193
      DSGC/Algebra.py
  10. 346 215
      DSGC/Algebra_Systemctl.py
  11. 398 228
      Data_Science/Learn.py
  12. 1894 342
      Data_Science/Me_learn.py
  13. 1071 161
      Git_controller/GIT.py
  14. 363 199
      Git_controller/Git_Ctrl.py
  15. 637 238
      HSCH/Func_Matlib.py
  16. 1335 349
      HSCH/Func_advanced.py
  17. 325 44
      Hello.py
  18. 407 263
      Machine_learning_analysis/Learn_Numpy.py
  19. 1740 339
      Machine_learning_analysis/Machine_learning.py
  20. 1 0
      New_TK/__init__.py

+ 1 - 1
.gitignore

@@ -129,4 +129,4 @@ dmypy.json
 
 # Pyre type checker
 .pyre/
-
+test*

+ 186 - 67
CGB/TK.py

@@ -3,7 +3,7 @@ from tkinter.filedialog import asksaveasfile
 import tkinter.messagebox
 from CGB import TK_HS
 
-help_doc= '''
+help_doc = '''
 *快捷键:
     d-不用点击左键画线(再次点击关闭)
     g-画直线(2)
@@ -46,124 +46,167 @@ help_doc= '''
     绘制函数-绘制基本初等函数和字定义解析函数
 '''
 
+
 def increasing_func_color():
     global ZColo
     ZColo = askcolor(title='选择颜色')[0]
 
+
 def subtraction_func_color():
     global JColo
     JColo = askcolor(title='选择颜色')[0]
 
+
 def select_color():
     global colo
     colo = askcolor(title='选择颜色')[0]
 
+
 def choose_save():
     global BC
-    BC = tkinter.filedialog.asksaveasfilename(title='选择保存位置',filetypes=[("PNG", ".png")])
-    if not BC:BC = None
-    else:BC += '.png'
+    BC = tkinter.filedialog.asksaveasfilename(
+        title='选择保存位置', filetypes=[("PNG", ".png")])
+    if not BC:
+        BC = None
+    else:
+        BC += '.png'
+
 
 def choose_open():
     global BG_IM
-    BG_IM = tkinter.filedialog.askopenfilename(title='选择载入图片',filetypes=[("PNG", ".png"),("JPG", ".jpg")])
-    if not BG_IM: BG_IM = None
+    BG_IM = tkinter.filedialog.askopenfilename(
+        title='选择载入图片', filetypes=[
+            ("PNG", ".png"), ("JPG", ".jpg")])
+    if not BG_IM:
+        BG_IM = None
 
 
 def switch_brush():
     global d
-    if tkinter.messagebox.askokcancel('提示', '要切换到刷子吗(可当橡皮使用)'):d = 10
+    if tkinter.messagebox.askokcancel('提示', '要切换到刷子吗(可当橡皮使用)'):
+        d = 10
+
 
 def switch_big():
     global d
-    if tkinter.messagebox.askokcancel('提示', '要切换到大笔吗'):d = 3
+    if tkinter.messagebox.askokcancel('提示', '要切换到大笔吗'):
+        d = 3
+
 
 def Set_d():
-    global d,d_Input
+    global d, d_Input
     Input = d_Input.get().replace(' ', '')
     try:
         Input = int(Input)
-        if tkinter.messagebox.askokcancel('提示', f'是否设定大小为{Input}(系统默认大小为:2)'):d = Input
-    except:
-        if tkinter.messagebox.askokcancel('提示', '设置失败,是否要切换到中笔吗'): d = 2
+        if tkinter.messagebox.askokcancel('提示', f'是否设定大小为{Input}(系统默认大小为:2)'):
+            d = Input
+    except BaseException:
+        if tkinter.messagebox.askokcancel('提示', '设置失败,是否要切换到中笔吗'):
+            d = 2
+
 
 def switch_stroke():
     global d
-    if tkinter.messagebox.askokcancel('提示', '要切换到中笔吗'):d = 2
+    if tkinter.messagebox.askokcancel('提示', '要切换到中笔吗'):
+        d = 2
+
 
 def switch_small():
     global d
-    if tkinter.messagebox.askokcancel('提示', '要切换到小笔吗?'):d = 1
+    if tkinter.messagebox.askokcancel('提示', '要切换到小笔吗?'):
+        d = 1
+
 
 def plot_coordinate():
     global XY
-    if tkinter.messagebox.askokcancel('提示', '是否绘制坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
+    if tkinter.messagebox.askokcancel(
+            '提示', '是否绘制坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
         XY = 1
-    else:XY = None
+    else:
+        XY = None
+
 
 def plot_coordinate_small():
     global XY
-    if tkinter.messagebox.askokcancel('提示', '是否绘制小跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
+    if tkinter.messagebox.askokcancel(
+            '提示', '是否绘制小跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
         XY = 2
-    else:XY = None
+    else:
+        XY = None
+
 
 def plot_coordinate_big_span():
     global XY
-    if tkinter.messagebox.askokcancel('提示', '是否绘制大跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
+    if tkinter.messagebox.askokcancel(
+            '提示', '是否绘制大跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
         XY = 3
-    else:XY = None
+    else:
+        XY = None
+
 
 def set_span():
-    global XY,k,k_Input
+    global XY, k, k_Input
     Input = k_Input.get().replace(' ', '')
     try:
         Input = int(Input)
-        if tkinter.messagebox.askokcancel('提示', f'是否设定跨度为{Input}(跨度代表坐标系一个单位大小的实际像素,系统默认大跨度为:120)'):
+        if tkinter.messagebox.askokcancel(
+                '提示', f'是否设定跨度为{Input}(跨度代表坐标系一个单位大小的实际像素,系统默认大跨度为:120)'):
             k = Input
             XY = 1
         else:
             XY = None
             k = None
-    except:
+    except BaseException:
         k = None
-        if tkinter.messagebox.askokcancel('提示', '是否绘制大跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
+        if tkinter.messagebox.askokcancel(
+                '提示', '是否绘制大跨度的坐标系,确定后返回草图界面任一点三点开始绘制(点击取消可撤销未执行的清空)'):
             XY = 3
         else:
             XY = None
 
+
 def empty():
     global BG
     if tkinter.messagebox.askokcancel('提示', '是否清空草稿(点击取消可撤销未执行的清空)'):
         BG = askcolor(title='选择背景颜色')[0]
-    else:BG = None
+    else:
+        BG = None
+
 
 def open_func_box():
-    global HS_List,closeable
+    global HS_List, closeable
     HS_List = TK_HS.func_box()
 
+
 def _help():
     global help_doc
     tkinter.messagebox.showinfo(title='帮助', message=help_doc)
 
-def close():#关闭屏幕事件
+
+def close():  # 关闭屏幕事件
     global top
-    try:TK_HS.TK_DoneHS.top.destroy()
-    except:pass
-    try:TK_HS.top.destroy()
-    except:pass
+    try:
+        TK_HS.TK_DoneHS.top.destroy()
+    except BaseException:
+        pass
+    try:
+        TK_HS.top.destroy()
+    except BaseException:
+        pass
     top.destroy()
 
+
 def tool_box():
-    global colo#三个月还有这个一般v额u
-    global ZColo,JColo
-    global top#初始化屏幕
+    global colo  # 三个月还有这个一般v额u
+    global ZColo, JColo
+    global top  # 初始化屏幕
     global d
     global BG
     global XY
-    global HS_List#绘制函数列表
-    global BC#保存路径
+    global HS_List  # 绘制函数列表
+    global BC  # 保存路径
     global k
-    global d_Input,k_Input#定义Enter组件
+    global d_Input, k_Input  # 定义Enter组件
     global BG_IM
     global closeable
     closeable = True
@@ -176,43 +219,119 @@ def tool_box():
     ZColo = None
     JColo = None
     BC = None
-    w_b=20
-    h_b=3
+    w_b = 20
+    h_b = 3
     k = None
 
-
     top = tkinter.Tk()  # 设置屏幕
     top.title('')
     top.resizable(width=False, height=False)
     top.geometry(f'+10+10')
 
-    tkinter.Button(top, text ="选择颜色", command = select_color, width = w_b, height = h_b).pack()#选择颜色组件
-    tkinter.Button(top, text="选择增函数颜色", command=increasing_func_color, width=w_b, height=1).pack()  # 选择颜色组件
-    tkinter.Button(top, text="选择减函数颜色", command=subtraction_func_color, width=w_b, height=1).pack()  # 选择颜色组件
-    tkinter.Button(top, text="使用中笔(默认笔)", command=switch_stroke, width=w_b, height=h_b).pack()  # 切换笔
-    tkinter.Button(top, text="使用大笔", command = switch_big, width = w_b, height = 1).pack()  # 切换到大笔
-    tkinter.Button(top, text="使用小笔", command=switch_small, width=w_b, height=1).pack()  # 切换笔
-    tkinter.Button(top, text="使用刷子", command=switch_brush, width=w_b, height=1).pack()  # 切换笔
-    d_Input = tkinter.Entry(top, width=w_b-2)
+    tkinter.Button(top, text="选择颜色", command=select_color,
+                   width=w_b, height=h_b).pack()  # 选择颜色组件
+    tkinter.Button(
+        top,
+        text="选择增函数颜色",
+        command=increasing_func_color,
+        width=w_b,
+        height=1).pack()  # 选择颜色组件
+    tkinter.Button(
+        top,
+        text="选择减函数颜色",
+        command=subtraction_func_color,
+        width=w_b,
+        height=1).pack()  # 选择颜色组件
+    tkinter.Button(
+        top,
+        text="使用中笔(默认笔)",
+        command=switch_stroke,
+        width=w_b,
+        height=h_b).pack()  # 切换笔
+    tkinter.Button(
+        top,
+        text="使用大笔",
+        command=switch_big,
+        width=w_b,
+        height=1).pack()  # 切换到大笔
+    tkinter.Button(
+        top,
+        text="使用小笔",
+        command=switch_small,
+        width=w_b,
+        height=1).pack()  # 切换笔
+    tkinter.Button(
+        top,
+        text="使用刷子",
+        command=switch_brush,
+        width=w_b,
+        height=1).pack()  # 切换笔
+    d_Input = tkinter.Entry(top, width=w_b - 2)
     d_Input.pack(fill=tkinter.BOTH)
-    tkinter.Button(top, text="使用自定义大小", command=Set_d, width=w_b, height=1).pack()  # 切换笔
-    tkinter.Button(top, text="清空草稿", command=empty, width=w_b, height=h_b).pack()  # 填充背景
-    tkinter.Button(top, text="绘制坐标系", command=plot_coordinate, width=w_b, height=h_b).pack()  # 绘制坐标系
-    tkinter.Button(top, text="绘制坐标系(小跨度)", command=plot_coordinate_small, width=w_b, height=1).pack()  # 绘制坐标系
-    tkinter.Button(top, text="绘制坐标系(大跨度)", command=plot_coordinate_big_span, width=w_b, height=1).pack()  # 绘制坐标系
-    k_Input = tkinter.Entry(top, width=w_b-2)
+    tkinter.Button(
+        top,
+        text="使用自定义大小",
+        command=Set_d,
+        width=w_b,
+        height=1).pack()  # 切换笔
+    tkinter.Button(
+        top,
+        text="清空草稿",
+        command=empty,
+        width=w_b,
+        height=h_b).pack()  # 填充背景
+    tkinter.Button(
+        top,
+        text="绘制坐标系",
+        command=plot_coordinate,
+        width=w_b,
+        height=h_b).pack()  # 绘制坐标系
+    tkinter.Button(
+        top,
+        text="绘制坐标系(小跨度)",
+        command=plot_coordinate_small,
+        width=w_b,
+        height=1).pack()  # 绘制坐标系
+    tkinter.Button(
+        top,
+        text="绘制坐标系(大跨度)",
+        command=plot_coordinate_big_span,
+        width=w_b,
+        height=1).pack()  # 绘制坐标系
+    k_Input = tkinter.Entry(top, width=w_b - 2)
     k_Input.pack(fill=tkinter.BOTH)
-    tkinter.Button(top, text="使用自定义跨度", command=set_span, width=w_b, height=1).pack()  # 切换笔
-    tkinter.Button(top, text="绘制函数", command=open_func_box, width=w_b, height=h_b).pack()
-    tkinter.Button(top, text="保存", command=choose_save, width=w_b, height=1).pack()
-    tkinter.Button(top, text="载入", command=choose_open, width=w_b, height=1).pack()
-    tkinter.Button(top, text="帮助", command=_help, width=w_b, height=1).pack()#help是系统保留关键词,用_help代替
-    top.protocol('WM_DELETE_WINDOW',close)
+    tkinter.Button(
+        top,
+        text="使用自定义跨度",
+        command=set_span,
+        width=w_b,
+        height=1).pack()  # 切换笔
+    tkinter.Button(
+        top,
+        text="绘制函数",
+        command=open_func_box,
+        width=w_b,
+        height=h_b).pack()
+    tkinter.Button(
+        top,
+        text="保存",
+        command=choose_save,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="载入",
+        command=choose_open,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(top, text="帮助", command=_help, width=w_b,
+                   height=1).pack()  # help是系统保留关键词,用_help代替
+    top.protocol('WM_DELETE_WINDOW', close)
     top.mainloop()
-    return [colo,d,BG,XY,HS_List,BC,ZColo,JColo,k,BG_IM]
-    #[0]-笔的颜色
-    #[1]-笔的大小
-    #[2]-背景填充
-    #[3]-坐标系绘制
-    #[4]-函数绘制
-    #[5]-保存
+    return [colo, d, BG, XY, HS_List, BC, ZColo, JColo, k, BG_IM]
+    # [0]-笔的颜色
+    # [1]-笔的大小
+    # [2]-背景填充
+    # [3]-坐标系绘制
+    # [4]-函数绘制
+    # [5]-保存

+ 41 - 15
CGB/TK_DoneHS.py

@@ -13,47 +13,73 @@ help_doc = '''
 不支持定义域选择,不支持分段函数
 '''
 
+
 class FunctionExpression:
     def __init__(self, func):
         self.FUNC = func
-        self.NAME = {'x':0, 'Pi':math.pi, 'e':math.e, 'log':math.log,
-                     'sin':math.sin,'cos':math.cos,'tan':math.tan,
-                     'cot':lambda x:1/math.tan(x),'csc':lambda x:1/math.sin(x),
-                     'sec':lambda x:1/math.cos(x),'sinh':math.sinh,'cosh':math.cosh,
-                     'tanh':math.tanh,'asin':math.asin,'acos':math.acos,
-                     'atan':math.atan}
-
-    def __call__(self,x):
+        self.NAME = {
+            'x': 0,
+            'Pi': math.pi,
+            'e': math.e,
+            'log': math.log,
+            'sin': math.sin,
+            'cos': math.cos,
+            'tan': math.tan,
+            'cot': lambda x: 1 / math.tan(x),
+            'csc': lambda x: 1 / math.sin(x),
+            'sec': lambda x: 1 / math.cos(x),
+            'sinh': math.sinh,
+            'cosh': math.cosh,
+            'tanh': math.tanh,
+            'asin': math.asin,
+            'acos': math.acos,
+            'atan': math.atan}
+
+    def __call__(self, x):
         self.NAME['x'] = x
         return eval(self.FUNC, self.NAME)
 
+
 def determine():
-    global HS_Input,HS,help_doc
+    global HS_Input, HS, help_doc
     Input = HS_Input.get().replace(' ', '')
     if Input:
-        if tkinter.messagebox.askokcancel('提示', f'是否确认生成自定义函数:\n{HS_Input.get()}\n(点击取消可撤销未执行的制造函数)'):
+        if tkinter.messagebox.askokcancel(
+                '提示', f'是否确认生成自定义函数:\n{HS_Input.get()}\n(点击取消可撤销未执行的制造函数)'):
             HS = FunctionExpression(HS_Input.get())
-        else:HS = None
+        else:
+            HS = None
     else:
         if tkinter.messagebox.askokcancel('提示', f'点击确定撤销为执行的制造函数'):
             HS = None
 
+
 def get_help():
     tkinter.messagebox.showinfo(title='帮助', message=help_doc)
 
 
 def make_func():
-    global HS_Input,HS,top
+    global HS_Input, HS, top
     HS = None
     top = tkinter.Tk()  # 设置屏幕
     top.title('')
     top.resizable(width=False, height=False)
     top.geometry(f'+350+10')
-    button = tkinter.Button(top, text="制造函数", command=determine, width=28, height=1)  # 收到消息执行这个函数
-    help = tkinter.Button(top, text="帮助", command=get_help, width=28, height=1)  # 帮助菜单
+    button = tkinter.Button(
+        top,
+        text="制造函数",
+        command=determine,
+        width=28,
+        height=1)  # 收到消息执行这个函数
+    help = tkinter.Button(
+        top,
+        text="帮助",
+        command=get_help,
+        width=28,
+        height=1)  # 帮助菜单
     HS_Input = tkinter.Entry(top)
     HS_Input.pack(fill=tkinter.BOTH)
     button.pack()
     help.pack()
     top.mainloop()
-    return HS
+    return HS

+ 180 - 50
CGB/TK_HS.py

@@ -2,191 +2,321 @@ import tkinter.messagebox
 import math
 from CGB import TK_DoneHS
 
+
 def linear_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制1次函数(点击取消可撤销未执行的函数)'):
-        HS_List[1] = lambda x:x
+        HS_List[1] = lambda x: x
     else:
         HS_List[1] = None
 
+
 def quadratic_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制2次函数(点击取消可撤销未执行的函数)'):
-        HS_List[2] = lambda x:x**2
+        HS_List[2] = lambda x: x**2
     else:
         HS_List[2] = None
 
+
 def cubic_function():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制3次函数(点击取消可撤销未执行的函数)'):
-        HS_List[4] = lambda x:x**3
+        HS_List[4] = lambda x: x**3
     else:
         HS_List[4] = None
 
+
 def inverse_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制-1次函数(点击取消可撤销未执行的函数)'):
-        HS_List[3] = lambda x:1/x
+        HS_List[3] = lambda x: 1 / x
     else:
         HS_List[3] = None
 
+
 def radical_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制根号函数(点击取消可撤销未执行的函数)'):
-        HS_List[5] = lambda x:x**(1/2)
+        HS_List[5] = lambda x: x**(1 / 2)
     else:
         HS_List[5] = None
 
+
 def exp_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制指数函数(点击取消可撤销未执行的函数)'):
-        HS_List[6] = lambda x:10**x
+        HS_List[6] = lambda x: 10**x
     else:
         HS_List[6] = None
 
+
 def log_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制对数函数(点击取消可撤销未执行的函数)'):
-        HS_List[7] = lambda x:math.log(x,2)
+        HS_List[7] = lambda x: math.log(x, 2)
     else:
         HS_List[7] = None
 
+
 def log2_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制对数函数2(点击取消可撤销未执行的函数)'):
-        HS_List[8] = lambda x:math.log(2,x)
+        HS_List[8] = lambda x: math.log(2, x)
     else:
         HS_List[8] = None
 
+
 def sin_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制正弦函数(点击取消可撤销未执行的函数)'):
-        HS_List[9] = lambda x:math.sin(x)
+        HS_List[9] = lambda x: math.sin(x)
     else:
         HS_List[9] = None
 
+
 def cos_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制余弦函数(点击取消可撤销未执行的函数)'):
-        HS_List[10] = lambda x:math.cos(x)
+        HS_List[10] = lambda x: math.cos(x)
     else:
         HS_List[10] = None
 
+
 def tan_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制正切函数(点击取消可撤销未执行的函数)'):
-        HS_List[11] = lambda x:math.tan(x)
+        HS_List[11] = lambda x: math.tan(x)
     else:
         HS_List[11] = None
 
+
 def cot_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制余切函数(点击取消可撤销未执行的函数)'):
-        HS_List[12] = lambda x:1/math.tan(x)
+        HS_List[12] = lambda x: 1 / math.tan(x)
     else:
         HS_List[12] = None
 
+
 def sec_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制正割函数(点击取消可撤销未执行的函数)'):
-        HS_List[13] = lambda x:1/math.cos(x)
+        HS_List[13] = lambda x: 1 / math.cos(x)
     else:
         HS_List[13] = None
 
+
 def csc_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制余割函数(点击取消可撤销未执行的函数)'):
-        HS_List[11] = lambda x:1/math.sin(x)
+        HS_List[11] = lambda x: 1 / math.sin(x)
     else:
         HS_List[11] = None
 
+
 def arcsin_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反正弦函数(点击取消可撤销未执行的函数)'):
-        HS_List[12] = lambda x:math.asin(x)
+        HS_List[12] = lambda x: math.asin(x)
     else:
         HS_List[12] = None
 
+
 def arccos_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反余弦函数(点击取消可撤销未执行的函数)'):
-        HS_List[13] = lambda x:math.acos(x)
+        HS_List[13] = lambda x: math.acos(x)
     else:
         HS_List[13] = None
 
+
 def arctan_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反正切函数(点击取消可撤销未执行的函数)'):
-        HS_List[14] = lambda x:math.atan(x)
+        HS_List[14] = lambda x: math.atan(x)
     else:
         HS_List[14] = None
 
+
 def arccot_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反余切函数(点击取消可撤销未执行的函数)'):
-        HS_List[15] = lambda x:1/math.atan(x)
+        HS_List[15] = lambda x: 1 / math.atan(x)
     else:
         HS_List[15] = None
 
+
 def arcsec_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反正割函数(点击取消可撤销未执行的函数)'):
-        HS_List[16] = lambda x:1/math.acos(x)
+        HS_List[16] = lambda x: 1 / math.acos(x)
     else:
         HS_List[16] = None
 
+
 def arccsc_func():
     global HS_List
     if tkinter.messagebox.askokcancel('提示', '是否绘制反余割函数(点击取消可撤销未执行的函数)'):
-        HS_List[17] = lambda x:1/math.asin(x)
+        HS_List[17] = lambda x: 1 / math.asin(x)
     else:
         HS_List[17] = None
 
+
 def custom_func():
-    global HS_List,Num
+    global HS_List, Num
     get = TK_DoneHS.make_func()
-    if get != None:
+    if get is not None:
         HS_List[Num] = get
         Num += 1
 
+
 def close():
     global top
-    try:TK_DoneHS.top.destroy()
-    except:pass
+    try:
+        TK_DoneHS.top.destroy()
+    except BaseException:
+        pass
     top.destroy()
 
+
 def func_box():
-    global HS_List#绘制函数列表
-    global Num,top
-    Num = 18#字定义函数的序号
+    global HS_List  # 绘制函数列表
+    global Num, top
+    Num = 18  # 字定义函数的序号
     HS_List = {}
-    w_b=20
+    w_b = 20
 
     top = tkinter.Tk()  # 设置屏幕
     top.title('')
     top.resizable(width=False, height=False)
     top.geometry(f'+180+10')
-    tkinter.Button(top, text="1次函数", command=linear_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="2次函数", command=quadratic_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="-1次函数", command=inverse_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="3次函数", command=cubic_function, width=w_b, height=1).pack()
-    tkinter.Button(top, text="根号函数", command=radical_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="对数函数", command=log_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="指数函数", command=exp_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="对数底函数", command=log2_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="sin函数", command=sin_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="cos函数", command=cos_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="tan函数", command=tan_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="cot函数", command=tan_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="csc函数", command=csc_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="sec函数", command=sec_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arcsin函数", command=arcsin_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arccos函数", command=arccos_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arctan函数", command=arctan_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arccot函数", command=arccot_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arccsc函数", command=arccsc_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="arcsec函数", command=arcsec_func, width=w_b, height=1).pack()
-    tkinter.Button(top, text="自定义函数", command=custom_func, width=w_b, height=3).pack()
+    tkinter.Button(
+        top,
+        text="1次函数",
+        command=linear_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="2次函数",
+        command=quadratic_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="-1次函数",
+        command=inverse_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="3次函数",
+        command=cubic_function,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="根号函数",
+        command=radical_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="对数函数",
+        command=log_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="指数函数",
+        command=exp_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="对数底函数",
+        command=log2_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="sin函数",
+        command=sin_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="cos函数",
+        command=cos_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="tan函数",
+        command=tan_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="cot函数",
+        command=tan_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="csc函数",
+        command=csc_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="sec函数",
+        command=sec_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arcsin函数",
+        command=arcsin_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arccos函数",
+        command=arccos_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arctan函数",
+        command=arctan_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arccot函数",
+        command=arccot_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arccsc函数",
+        command=arccsc_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="arcsec函数",
+        command=arcsec_func,
+        width=w_b,
+        height=1).pack()
+    tkinter.Button(
+        top,
+        text="自定义函数",
+        command=custom_func,
+        width=w_b,
+        height=3).pack()
     top.protocol('WM_DELETE_WINDOW', close)
     top.mainloop()
-    return HS_List
+    return HS_List

+ 325 - 204
CGB/Write.py

@@ -4,10 +4,10 @@ from CGB.TK import tool_box
 import time
 import os
 
-#定义一些变量
+# 定义一些变量
 PEN_C = [0, 0, 0]  # 画笔颜色
-Z_C = [0,0,255]
-J_C = [255,0,0]
+Z_C = [0, 0, 255]
+J_C = [255, 0, 0]
 PEN_THICKNESS = 2  # 圆形的粗细(线条*2)=中笔
 m_x = None
 m_y = None  # 为画图所准备的
@@ -29,124 +29,176 @@ line = []  # 画线列表
 rect = []  # 画矩阵和圆列表
 poly = []  # 画多边形列表
 
-tips = ''#设置备注
+tips = ''  # 设置备注
 
-BC_Dic = ''#保存路径
-Tip = [0,0,0,0,0]#底部显示信息[x,y,左键,中间,右键]
+BC_Dic = ''  # 保存路径
+Tip = [0, 0, 0, 0, 0]  # 底部显示信息[x,y,左键,中间,右键]
 
 mode = {1: '绘制坐标系', 2: '绘制直线(g)', 3: '填充矩形(f)', 4: '线条矩形(s)',
-        5:'绘制横线(k)', 6:'绘制竖线(l)', 7:'绘制多段线(j)',
-        8:'绘制横打点多段线(i)', 9:'绘制竖打点多段线(u)', 10:'坐标测绘(h)',
-        11:'绘制虚线(q)', 12:'填充圆形(c)', 13:'线条圆形(v)', 14:'多边形(n-填充,m-线条)',
-        15:'填充椭圆形(e)', 16:'线条椭圆形(r)', 0:'None'}#快捷键名字
+        5: '绘制横线(k)', 6: '绘制竖线(l)', 7: '绘制多段线(j)',
+        8: '绘制横打点多段线(i)', 9: '绘制竖打点多段线(u)', 10: '坐标测绘(h)',
+        11: '绘制虚线(q)', 12: '填充圆形(c)', 13: '线条圆形(v)', 14: '多边形(n-填充,m-线条)',
+        15: '填充椭圆形(e)', 16: '线条椭圆形(r)', 0: 'None'}  # 快捷键名字
 
-#绘制函数
-def func_draw(HS_list, JD = 1000):
-    global X_P,X_L,Y_C,Y_L,Y_M,X_M,PEN_C,Z_C,J_C
-    c = [0,0,0]#增函数颜色
-    X_Done = lambda x: (x - X_L[0]) / (X_L[1] - X_L[0]) * (X_P[1] - X_P[0]) + X_P[0]#x是数值,换算为像素
-    Y_Done = lambda y: (y - Y_L[0]) / (Y_L[1] - Y_L[0]) * (Y_C[1] - Y_C[0]) + Y_C[0]  # x是数值,换算为像素
+# 绘制函数
+
+
+def func_draw(HS_list, JD=1000):
+    global X_P, X_L, Y_C, Y_L, Y_M, X_M, PEN_C, Z_C, J_C
+    c = [0, 0, 0]  # 增函数颜色
+    def X_Done(x): return (
+        x - X_L[0]) / (X_L[1] - X_L[0]) * (X_P[1] - X_P[0]) + X_P[0]  # x是数值,换算为像素
+    def Y_Done(y): return (
+        y - Y_L[0]) / (Y_L[1] - Y_L[0]) * (Y_C[1] - Y_C[0]) + Y_C[0]  # x是数值,换算为像素
     for i in HS_list:
         x1 = None  # 上一组X和Y
         y1 = None
-        if HS_list == None:continue
+        if HS_list is None:
+            continue
         D = HS_list[i]
         try:
-            for x in range((X_L[0]-1)*JD,(X_L[1]+1)*JD,1):
+            for x in range((X_L[0] - 1) * JD, (X_L[1] + 1) * JD, 1):
                 x /= JD
                 try:
                     y = D(x)
-                except:
+                except BaseException:
                     x1 = None
                     y1 = None
                     continue
                 try:
                     x2 = X_Done(x)
                     y2 = Y_Done(y)
-                    if y2>Y_M[0] or y2<Y_M[1] or x2<X_M[0] or x2>X_M[1]:
+                    if y2 > Y_M[0] or y2 < Y_M[1] or x2 < X_M[0] or x2 > X_M[1]:
                         x1 = None
                         y1 = None
                         continue
-                except TypeError:#预防复数
+                except TypeError:  # 预防复数
                     continue
-                if x1 != None:
-                    if y1>y2:c=Z_C#增函数
-                    elif y1<y2:c=J_C#减函数#改为检查Y数值而不是坐标
-                    pygame.draw.line(root, c, (int(x1),int(y1)), (int(x2),int(y2)), PEN_THICKNESS)
+                if x1 is not None:
+                    if y1 > y2:
+                        c = Z_C  # 增函数
+                    elif y1 < y2:
+                        c = J_C  # 减函数#改为检查Y数值而不是坐标
+                    pygame.draw.line(
+                        root, c, (int(x1), int(y1)), (int(x2), int(y2)), PEN_THICKNESS)
                 x1 = x2
                 y1 = y2
         except IndexError:
             break
 
-#画曲线系统
-def draw_line(xy, c=False):#c-是否带点
-    global m_x,m_y
-    if c:pygame.draw.circle(root, PEN_C, xy, PEN_THICKNESS, 0)
-    if m_x != None:
+# 画曲线系统
+
+
+def draw_line(xy, c=False):  # c-是否带点
+    global m_x, m_y
+    if c:
+        pygame.draw.circle(root, PEN_C, xy, PEN_THICKNESS, 0)
+    if m_x is not None:
         pygame.draw.line(root, PEN_C, (m_x, m_y), xy, PEN_THICKNESS)
     m_x = xy[0]
     m_y = xy[1]
 
-#绘制XY坐标系
-def coordinate_draw(s_x, s_y, p = (-100, 100), c = (-200, 100), kd = 10, b = 3, jt = 3, r = 3):
-    kd = abs(kd)#kd大于0
-    global PEN_THICKNESS,XY_x,XY_y,X_L,X_P,Y_L,Y_C,X_M,Y_M
+# 绘制XY坐标系
+
+
+def coordinate_draw(s_x, s_y, p=(-100, 100),
+                    c=(-200, 100), kd=10, b=3, jt=3, r=3):
+    kd = abs(kd)  # kd大于0
+    global PEN_THICKNESS, XY_x, XY_y, X_L, X_P, Y_L, Y_C, X_M, Y_M
     XY_x = s_x
-    XY_y = s_y#存储原点坐标
-    X_M = [s_x + p[0],s_x + p[1]]
-    Y_M = [s_y + c[1],s_y + c[0]]
-    pygame.draw.circle(root, PEN_C, (s_x, s_y), r, 0)#绘制原点
-    pygame.draw.line(root, PEN_C, (s_x + p[0], s_y), (s_x + p[1], s_y), PEN_THICKNESS)  # X轴,Y定
-    pygame.draw.line(root, PEN_C, (s_x, s_y + c[0]), (s_x, s_y + c[1]), PEN_THICKNESS)  # y轴,x定
-    _a = 0#刻度统计
+    XY_y = s_y  # 存储原点坐标
+    X_M = [s_x + p[0], s_x + p[1]]
+    Y_M = [s_y + c[1], s_y + c[0]]
+    pygame.draw.circle(root, PEN_C, (s_x, s_y), r, 0)  # 绘制原点
+    pygame.draw.line(
+        root, PEN_C, (s_x + p[0], s_y), (s_x + p[1], s_y), PEN_THICKNESS)  # X轴,Y定
+    pygame.draw.line(
+        root, PEN_C, (s_x, s_y + c[0]), (s_x, s_y + c[1]), PEN_THICKNESS)  # y轴,x定
+    _a = 0  # 刻度统计
     _c = 0
-    for i in range(s_x ,s_x + p[0], -kd):#右
+    for i in range(s_x, s_x + p[0], -kd):  # 
         _a -= 1
         pygame.draw.line(root, PEN_C, (i, s_y + b), (i, s_y), PEN_THICKNESS)
         _c = i
     _b = 0
     _d = 0
-    for i in range(s_x, s_x + p[1], kd):#刻度#左
+    for i in range(s_x, s_x + p[1], kd):  # 刻度#左
         _b += 1
         pygame.draw.line(root, PEN_C, (i, s_y + b), (i, s_y), PEN_THICKNESS)
         _d = i
-    X_L = [_a+1,_b-1]
-    X_P = [_c,_d]
+    X_L = [_a + 1, _b - 1]
+    X_P = [_c, _d]
     _a = 0
     _c = 0
-    for i in range(s_y, s_y + c[0], -kd):#上
+    for i in range(s_y, s_y + c[0], -kd):  # 
         _a += 1
         pygame.draw.line(root, PEN_C, (s_x + b, i), (s_x, i), PEN_THICKNESS)
         _c = i
     _b = 0
     _d = 0
-    for i in range(s_y, s_y + c[1], kd):#下
+    for i in range(s_y, s_y + c[1], kd):  # 
         _b -= 1
         pygame.draw.line(root, PEN_C, (s_x + b, i), (s_x, i), PEN_THICKNESS)
         _d = i
-    Y_L = [_b+1,_a-1]
-    Y_C = [_d,_c]
+    Y_L = [_b + 1, _a - 1]
+    Y_C = [_d, _c]
 
-    #箭头
-    pygame.draw.line(root, PEN_C, (s_x + p[1], s_y), (s_x + p[1] - jt, s_y + jt), PEN_THICKNESS)  # X上
-    pygame.draw.line(root, PEN_C, (s_x + p[1], s_y), (s_x + p[1] - jt, s_y - jt), PEN_THICKNESS)  # X下
+    # 箭头
+    pygame.draw.line(
+        root,
+        PEN_C,
+        (s_x + p[1],
+         s_y),
+        (s_x + p[1] - jt,
+         s_y + jt),
+        PEN_THICKNESS)  # X上
+    pygame.draw.line(
+        root,
+        PEN_C,
+        (s_x + p[1],
+         s_y),
+        (s_x + p[1] - jt,
+         s_y - jt),
+        PEN_THICKNESS)  # X下
+
+    pygame.draw.line(
+        root,
+        PEN_C,
+        (s_x,
+         s_y + c[0]),
+        (s_x - jt,
+         s_y + c[0] + jt),
+        PEN_THICKNESS)  # y左
+    pygame.draw.line(
+        root,
+        PEN_C,
+        (s_x,
+         s_y + c[0]),
+        (s_x + jt,
+         s_y + c[0] + jt),
+        PEN_THICKNESS)  # X下
 
-    pygame.draw.line(root, PEN_C, (s_x, s_y + c[0]), (s_x - jt, s_y + c[0] + jt), PEN_THICKNESS)  # y左
-    pygame.draw.line(root, PEN_C, (s_x, s_y + c[0]), (s_x + jt, s_y + c[0] + jt), PEN_THICKNESS)  # X下
 
 def top_draw():
-    #绘制顶部
-    global PEN_THICKNESS,Font,Tip,Screen_x,Screen_y,middle_key,BC_Dic,mode,continuous_draw,XY_x,XY_y,tips,line,rect,poly,PEN_C,Z_C,J_C,axy,_span
-    if continuous_draw:mod_d = '启动无点击画线(点击d关闭)'
-    else:mod_d = '关闭无点击画线'
-    pygame.draw.rect(root,[255,255,255], [0,0,Screen_x,16], 0)
-    pygame.draw.rect(root, [255, 255, 255], [0, Screen_y-16, Screen_x, Screen_y], 0)
+    # 绘制顶部
+    global PEN_THICKNESS, Font, Tip, Screen_x, Screen_y, middle_key, BC_Dic, mode, continuous_draw, XY_x, XY_y, tips, line, rect, poly, PEN_C, Z_C, J_C, axy, _span
+    if continuous_draw:
+        mod_d = '启动无点击画线(点击d关闭)'
+    else:
+        mod_d = '关闭无点击画线'
+    pygame.draw.rect(root, [255, 255, 255], [0, 0, Screen_x, 16], 0)
+    pygame.draw.rect(
+        root, [
+            255, 255, 255], [
+            0, Screen_y - 16, Screen_x, Screen_y], 0)
     p = ''
-    if middle_key == 0: tips = ''
-    if axy != [0,0,0]:
+    if middle_key == 0:
+        tips = ''
+    if axy != [0, 0, 0]:
         a = []
         for i in axy:
-            if i != 0:a.append(i)
+            if i != 0:
+                a.append(i)
         p += f'坐标端点:{str(a)}  '
     if line:
         p += f'端点:{str(line)}  '
@@ -155,110 +207,130 @@ def top_draw():
     if poly:
         p += f'多顶点:{str(poly)}  '
     if continuous_draw or middle_key != 0:
-        TIP3 = Font.render(f'模式:{mod_d} , {mode[middle_key]} {tips}', True, (0, 0, 0))
+        TIP3 = Font.render(
+            f'模式:{mod_d} , {mode[middle_key]} {tips}', True, (0, 0, 0))
     else:
         s = ''
-        if BC_Dic:s = f'保存路径(w):{BC_Dic}'
-        TIP3 = Font.render(f'{time.strftime("%Y/%m/%d  %I:%M")}  {s}', True, (0, 0, 0))
+        if BC_Dic:
+            s = f'保存路径(w):{BC_Dic}'
+        TIP3 = Font.render(
+            f'{time.strftime("%Y/%m/%d  %I:%M")}  {s}', True, (0, 0, 0))
         p = ''
     if p == '':
         p = f'主色调:{PEN_C} 增函数颜色:{Z_C} 减函数颜色:{J_C}'
-    TIP = Font.render(f'鼠标:{Tip[0]},{Tip[1]}',True, (0, 0, 0))
-    TIP2 = Font.render(f'{Tip[2]},{Tip[3]},{Tip[4]} ; 大小:{PEN_THICKNESS} ; 原点:{XY_x},{XY_y} ; 跨度:{_span} ; {p}', True, (0, 0, 0))
+    TIP = Font.render(f'鼠标:{Tip[0]},{Tip[1]}', True, (0, 0, 0))
+    TIP2 = Font.render(
+        f'{Tip[2]},{Tip[3]},{Tip[4]} ; 大小:{PEN_THICKNESS} ; 原点:{XY_x},{XY_y} ; 跨度:{_span} ; {p}',
+        True,
+        (0,
+         0,
+         0))
     root.blit(TIP, (0, 0))
     root.blit(TIP2, (100, 0))
     root.blit(TIP3, (0, Screen_y - 16))
 
-#主程序
+# 主程序
+
+
 def draw_main(dis_x=900, dis_y=700):
-    global m_x, m_y,PEN_C,PEN_THICKNESS,BG,XY,axy,XY_x,XY_y,_span,line,continuous_draw,middle_key,rect,poly,root,root_caption,done,m_x, m_y,BC_Dic#定义全局变量
-    global Z_C,J_C,Tip,Font,Screen_x,Screen_y,tips,Font
+    global m_x, m_y, PEN_C, PEN_THICKNESS, BG, XY, axy, XY_x, XY_y, _span, line, continuous_draw, middle_key, rect, poly, root, root_caption, done, m_x, m_y, BC_Dic  # 定义全局变量
+    global Z_C, J_C, Tip, Font, Screen_x, Screen_y, tips, Font
     Screen_x = dis_x
     Screen_y = dis_y
     done = pygame.init()  # 初始化所有模块
-    if done[1] != 0: print('Init!')  # 检查是否错误
-    Font = pygame.font.Font('Font\ZKST.ttf', 16)  # 设置字体(Linux下应该用\而不是/)
-    root = pygame.display.set_mode((dis_x, dis_y),0)  # 创建屏幕
-    root_caption = pygame.display.set_caption('CoTan草稿板')#定义标题(后期加上定义Logo)
+    if done[1] != 0:
+        print('Init!')  # 检查是否错误
+    Font = pygame.font.Font(r'Font\ZKST.ttf', 16)  # 设置字体(Linux下应该用\而不是/)
+    root = pygame.display.set_mode((dis_x, dis_y), 0)  # 创建屏幕
+    root_caption = pygame.display.set_caption('CoTan草稿板')  # 定义标题(后期加上定义Logo)
     root.fill([255, 255, 255])  # 默认用白色填充窗口
-    flat = True#循环条件(不是全局)
+    flat = True  # 循环条件(不是全局)
     while flat:
         top_draw()
-        pygame.display.update()#屏幕刷新
-        for event in pygame.event.get():#事件检查
-            if event.type == QUIT:#退出事件
+        pygame.display.update()  # 屏幕刷新
+        for event in pygame.event.get():  # 事件检查
+            if event.type == QUIT:  # 退出事件
                 pygame.quit()
                 flat = False
                 break
-            elif event.type == MOUSEMOTION:#鼠标移动事件
-                Tip[0],Tip[1] = event.pos
-                Tip[2],Tip[3],Tip[4] = event.buttons
-                if event.buttons == (1, 0, 0):#左键点击
+            elif event.type == MOUSEMOTION:  # 鼠标移动事件
+                Tip[0], Tip[1] = event.pos
+                Tip[2], Tip[3], Tip[4] = event.buttons
+                if event.buttons == (1, 0, 0):  # 左键点击
                     draw_line(event.pos)
-                elif event.buttons == (0, 0, 0):#无点击绘图(启动快捷键d)
+                elif event.buttons == (0, 0, 0):  # 无点击绘图(启动快捷键d)
                     if continuous_draw:
                         draw_line(event.pos)
-                    else:#m_x和m_y是指上一点的xy,用于画线系统
+                    else:  # m_x和m_y是指上一点的xy,用于画线系统
                         m_x = None
                         m_y = None
-            elif event.type == MOUSEBUTTONDOWN:#鼠标按下
+            elif event.type == MOUSEBUTTONDOWN:  # 鼠标按下
                 event.pos = list(event.pos)
-                if event.button == 3:#右键点击
+                if event.button == 3:  # 右键点击
                     Tip[4] = 1
-                    pygame.image.save(root,'$CoTanCC.png')#保存当前环境
-                    root = pygame.display.set_mode((dis_x, dis_y), pygame.NOFRAME)#隐藏关闭按钮
-                    bg = pygame.image.load('$CoTanCC.png').convert()#加载位图
-                    root.blit(bg, (0, 0))#绘制位图
-                    pygame.display.update()#更新屏幕
-                    g = tool_box()#启动工具箱
-                    root = pygame.display.set_mode((dis_x, dis_y), 0)#显示关闭按钮
-                    bg = pygame.image.load('$CoTanCC.png').convert()#加载位图
-                    root.blit(bg, (0, 0))#绘制位图
-                    pygame.display.update()#更新屏幕
+                    pygame.image.save(root, '$CoTanCC.png')  # 保存当前环境
+                    root = pygame.display.set_mode(
+                        (dis_x, dis_y), pygame.NOFRAME)  # 隐藏关闭按钮
+                    bg = pygame.image.load('$CoTanCC.png').convert()  # 加载位图
+                    root.blit(bg, (0, 0))  # 绘制位图
+                    pygame.display.update()  # 更新屏幕
+                    g = tool_box()  # 启动工具箱
+                    root = pygame.display.set_mode((dis_x, dis_y), 0)  # 显示关闭按钮
+                    bg = pygame.image.load('$CoTanCC.png').convert()  # 加载位图
+                    root.blit(bg, (0, 0))  # 绘制位图
+                    pygame.display.update()  # 更新屏幕
                     os.remove('$CoTanCC.png')
-                    if g[0] != None:PEN_C = g[0]#设置颜色
-                    if g[1] != None:PEN_THICKNESS = g[1]#设置笔的粗细
-                    if g[2] != None: root.fill(g[2])#设置背景填充
-                    if g[3] == 1:#绘制坐标系
+                    if g[0] is not None:
+                        PEN_C = g[0]  # 设置颜色
+                    if g[1] is not None:
+                        PEN_THICKNESS = g[1]  # 设置笔的粗细
+                    if g[2] is not None:
+                        root.fill(g[2])  # 设置背景填充
+                    if g[3] == 1:  # 绘制坐标系
                         tips = '选择坐标三个端点'
                         middle_key = 1
                         XY = 3
                         _span = 60
-                    elif g[3] == 2:#绘制坐标系2(小跨度)
+                    elif g[3] == 2:  # 绘制坐标系2(小跨度)
                         tips = '选择坐标三个端点'
                         middle_key = 1
                         XY = 3
                         _span = 20
-                    elif g[3] == 3:#绘制坐标系3(大跨度)
+                    elif g[3] == 3:  # 绘制坐标系3(大跨度)
                         tips = '选择坐标三个端点'
                         middle_key = 1
                         XY = 3
-                        _span = 120#坐标系跨度(字定义跨度再下面)
+                        _span = 120  # 坐标系跨度(字定义跨度再下面)
                     else:
                         middle_key = 0
-                        XY = 0#恢复选项
-                    if g[6] != None: Z_C = g[6]  # 增函数颜色(要在函数绘制之前设置好)
-                    if g[7] != None: J_C = g[7]  # 减函数颜色
-                    if g[4] != {}:func_draw(g[4])#函数绘制
-                    if g[5] != None:
+                        XY = 0  # 恢复选项
+                    if g[6] is not None:
+                        Z_C = g[6]  # 增函数颜色(要在函数绘制之前设置好)
+                    if g[7] is not None:
+                        J_C = g[7]  # 减函数颜色
+                    if g[4] != {}:
+                        func_draw(g[4])  # 函数绘制
+                    if g[5] is not None:
                         pygame.image.save(root, g[5])  # 保存当前环境
                         BC_Dic = g[5]
-                    if g[8] != None: _span = g[8]  # 自定义跨度
-                    if g[9] != None:
+                    if g[8] is not None:
+                        _span = g[8]  # 自定义跨度
+                    if g[9] is not None:
                         try:
                             bg_im = pygame.image.load(g[9]).convert()  # 加载位图
                             root.blit(bg_im, (0, 0))  # 绘制位图
-                        except:pass
-                    #恢复参数
+                        except BaseException:
+                            pass
+                    # 恢复参数
                     m_x = None
                     m_y = None
                     continuous_draw = False
                     pygame.event.clear()
-                elif event.button == 2:#中键点击,ZJ是指中键的模式,来自快捷键和工具箱
+                elif event.button == 2:  # 中键点击,ZJ是指中键的模式,来自快捷键和工具箱
                     Tip[3] = 1
-                    if middle_key == 1:#坐标系模式
+                    if middle_key == 1:  # 坐标系模式
                         tips = '选择下一个端点(共3个)'
-                        axy[XY-1] = event.pos#存储
+                        axy[XY - 1] = event.pos  # 存储
                         XY -= 1
                         if XY == 0:
                             x = []
@@ -267,7 +339,7 @@ def draw_main(dis_x=900, dis_y=700):
                                 x.append(i[0])
                                 y.append(i[1])
                             x.sort()
-                            y.sort()#排序
+                            y.sort()  # 排序
                             s_x = x[1]
                             s_y = y[1]
                             p = (-abs(x[0] - x[1]), abs(x[1] - x[2]))
@@ -276,213 +348,262 @@ def draw_main(dis_x=900, dis_y=700):
                             r = 2 * PEN_THICKNESS
                             jt = 3 * PEN_THICKNESS
                             coordinate_draw(s_x, s_y, p, c, _span, b, jt, r)
-                            axy = [0,0,0]
+                            axy = [0, 0, 0]
                             middle_key = 0
-                    elif middle_key == 2:#画线模式
+                    elif middle_key == 2:  # 画线模式
                         line.append(event.pos)
                         # pygame.draw.circle(root, pen_C, event.pos, d, 0)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], line[1], PEN_THICKNESS)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], line[1], PEN_THICKNESS)
                             middle_key = 0
-                    elif middle_key == 3 or middle_key == 4:#画矩形模式
+                    elif middle_key == 3 or middle_key == 4:  # 画矩形模式
                         rect.append(event.pos)
                         if len(rect) == 2:
                             x = [rect[0][0], rect[1][0]]
                             y = [rect[0][1], rect[1][1]]
-                            x.sort();y.sort()
-                            if middle_key == 3:dx = 0
-                            else:dx = PEN_THICKNESS
-                            pygame.draw.rect(root, PEN_C, [x[0], y[0], x[1] - x[0], y[1] - y[0]], dx)
+                            x.sort()
+                            y.sort()
+                            if middle_key == 3:
+                                dx = 0
+                            else:
+                                dx = PEN_THICKNESS
+                            pygame.draw.rect(
+                                root, PEN_C, [
+                                    x[0], y[0], x[1] - x[0], y[1] - y[0]], dx)
                             middle_key = 0
-                    elif middle_key == 5:#画横线模式
+                    elif middle_key == 5:  # 画横线模式
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)
                             middle_key = 0
-                    elif middle_key == 6:#画竖线模式
+                    elif middle_key == 6:  # 画竖线模式
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)
                             middle_key = 0
-                    elif middle_key == 7:#画线多段线
+                    elif middle_key == 7:  # 画线多段线
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], line[1], PEN_THICKNESS)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], line[1], PEN_THICKNESS)
                             del line[0]
-                    elif middle_key == 8:#画横线多段线
+                    elif middle_key == 8:  # 画横线多段线
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)
-                            pygame.draw.circle(root, PEN_C, (line[1][0], line[0][1]), PEN_THICKNESS * 2, 0)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)
+                            pygame.draw.circle(
+                                root, PEN_C, (line[1][0], line[0][1]), PEN_THICKNESS * 2, 0)
                             del line[1]
                         else:
-                            pygame.draw.circle(root, PEN_C, event.pos, PEN_THICKNESS, 0)
-                    elif middle_key == 9:#画竖线多段线
+                            pygame.draw.circle(
+                                root, PEN_C, event.pos, PEN_THICKNESS, 0)
+                    elif middle_key == 9:  # 画竖线多段线
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)
-                            pygame.draw.circle(root, PEN_C, (line[0][0], line[1][1]), PEN_THICKNESS * 2, 0)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)
+                            pygame.draw.circle(
+                                root, PEN_C, (line[0][0], line[1][1]), PEN_THICKNESS * 2, 0)
                             del line[1]
                         else:
-                            pygame.draw.circle(root, PEN_C, event.pos, PEN_THICKNESS, 0)
-                    elif middle_key == 10:#画竖线和横线多段线
+                            pygame.draw.circle(
+                                root, PEN_C, event.pos, PEN_THICKNESS, 0)
+                    elif middle_key == 10:  # 画竖线和横线多段线
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)#横线
-                            pygame.draw.circle(root, PEN_C, (line[1][0], line[0][1]), PEN_THICKNESS * 2, 0)
-                            pygame.draw.circle(root, PEN_C, (line[1][0], line[1][1]), PEN_THICKNESS * 2, 0)
-                            pygame.draw.line(root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)#竖线
-                            pygame.draw.circle(root, PEN_C, (line[0][0], line[1][1]), PEN_THICKNESS * 2, 0)
-                            #垂直于横线的虚线
-                            p = [line[1][1], line[0][1]]
-                            p.sort()
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[1][0], line[0][1]), PEN_THICKNESS)  # 横线
+                            pygame.draw.circle(
+                                root, PEN_C, (line[1][0], line[0][1]), PEN_THICKNESS * 2, 0)
+                            pygame.draw.circle(
+                                root, PEN_C, (line[1][0], line[1][1]), PEN_THICKNESS * 2, 0)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], (line[0][0], line[1][1]), PEN_THICKNESS)  # 竖线
+                            pygame.draw.circle(
+                                root, PEN_C, (line[0][0], line[1][1]), PEN_THICKNESS * 2, 0)
+                            # 垂直于横线的虚线
+                            p = sorted([line[1][1], line[0][1]])
                             Y1 = p[0]
                             Y2 = p[1]
                             a = list(range(Y1, Y2, 10))
-                            for i in range(int(len(a) / 2)):  # 向下取整,可用math.ceil代替
+                            for i in range(
+                                    int(len(a) / 2)):  # 向下取整,可用math.ceil代替
                                 i += 1
                                 i = 2 * i - 1
                                 y1 = a[i - 1]  # 计算两点的y坐标
                                 y2 = a[i]
-                                pygame.draw.line(root, PEN_C, (line[1][0], y1), (line[1][0], y2), PEN_THICKNESS)  # 横线
+                                pygame.draw.line(
+                                    root, PEN_C, (line[1][0], y1), (line[1][0], y2), PEN_THICKNESS)  # 横线
                             # 垂直于竖线的虚线
                             p = [line[1][0], line[0][0]]
                             p.sort()
                             X1 = p[0]
                             X2 = p[1]
                             a = list(range(X1, X2, 10))
-                            for i in range(int(len(a) / 2)):  # 向下取整,可用math.ceil代替
+                            for i in range(
+                                    int(len(a) / 2)):  # 向下取整,可用math.ceil代替
                                 i += 1
                                 i = 2 * i - 1
                                 x1 = a[i - 1]  # 计算两点的x坐标
                                 x2 = a[i]
-                                pygame.draw.line(root, PEN_C, (x1, line[1][1]), (x2, line[1][1]), PEN_THICKNESS)  # 横线
+                                pygame.draw.line(
+                                    root, PEN_C, (x1, line[1][1]), (x2, line[1][1]), PEN_THICKNESS)  # 横线
                             del line[1]
                         else:
-                            pygame.draw.circle(root, PEN_C, event.pos, PEN_THICKNESS, 0)
-                    elif middle_key == 11:#画虚线线模式
+                            pygame.draw.circle(
+                                root, PEN_C, event.pos, PEN_THICKNESS, 0)
+                    elif middle_key == 11:  # 画虚线线模式
                         line.append(event.pos)
-                        pygame.draw.circle(root, PEN_C, event.pos, PEN_THICKNESS, 0)
+                        pygame.draw.circle(
+                            root, PEN_C, event.pos, PEN_THICKNESS, 0)
                         if len(line) == 2:
                             if abs(line[0][0] - line[1][0]) >= 100:
                                 p1 = [line[0][0], line[1][0]]
-                                p2 = {line[0][0]:line[0][1], line[1][0]:line[1][1]}
+                                p2 = {
+                                    line[0][0]: line[0][1],
+                                    line[1][0]: line[1][1]}
                                 p1.sort()
                                 X1 = p1[0]
                                 Y1 = p2[X1]
                                 X2 = p1[1]
                                 Y2 = p2[X2]
                                 a = list(range(X1, X2, 10))
-                                for i in range(int(len(a) / 2)):  # 向下取整,可用math.ceil代替
+                                for i in range(
+                                        int(len(a) / 2)):  # 向下取整,可用math.ceil代替
                                     i += 1
                                     i = 2 * i - 1
                                     x1 = a[i - 1]  # 计算两点的x坐标
                                     x2 = a[i]
                                     y1 = (x1 - X1) / (X2 - X1) * (Y2 - Y1) + Y1
                                     y2 = (x2 - X1) / (X2 - X1) * (Y2 - Y1) + Y1
-                                    pygame.draw.line(root, PEN_C, (x1, y1), (x2, y2), PEN_THICKNESS)  # 横线
+                                    pygame.draw.line(
+                                        root, PEN_C, (x1, y1), (x2, y2), PEN_THICKNESS)  # 横线
                             elif abs(line[0][1] - line[1][1]) >= 100:
                                 p1 = [line[0][1], line[1][1]]
-                                p2 = {line[0][1]: line[0][0], line[1][1]: line[1][0]}
+                                p2 = {
+                                    line[0][1]: line[0][0],
+                                    line[1][1]: line[1][0]}
                                 p1.sort()
                                 Y1 = p1[0]
                                 X1 = p2[Y1]
                                 Y2 = p1[1]
                                 X2 = p2[Y2]
                                 a = list(range(Y1, Y2, 10))
-                                for i in range(int(len(a) / 2)):  # 向下取整,可用math.ceil代替
+                                for i in range(
+                                        int(len(a) / 2)):  # 向下取整,可用math.ceil代替
                                     i += 1
                                     i = 2 * i - 1
                                     y1 = a[i - 1]  # 计算两点的x坐标
                                     y2 = a[i]
                                     x1 = (y1 - Y1) / (Y2 - Y1) * (X2 - X1) + X1
                                     x2 = (y2 - Y1) / (Y2 - Y1) * (X2 - X1) + X1
-                                    pygame.draw.line(root, PEN_C, (x1, y1), (x2, y2), PEN_THICKNESS)  # 横线
+                                    pygame.draw.line(
+                                        root, PEN_C, (x1, y1), (x2, y2), PEN_THICKNESS)  # 横线
                             else:
-                                pygame.draw.line(root, PEN_C, line[1], line[0], PEN_THICKNESS)
+                                pygame.draw.line(
+                                    root, PEN_C, line[1], line[0], PEN_THICKNESS)
                             middle_key = 0
-                    elif middle_key == 12:#画圆模式
+                    elif middle_key == 12:  # 画圆模式
                         rect.append(event.pos)
                         if len(rect) == 2:
-                            r = int(((rect[0][0] - rect[1][0]) ** 2 + (rect[0][1] - rect[1][1]) ** 2) ** (1 / 2))#两点间求距离
+                            # 两点间求距离
+                            r = int(
+                                ((rect[0][0] - rect[1][0]) ** 2 + (rect[0][1] - rect[1][1]) ** 2) ** (1 / 2))
                             pygame.draw.circle(root, PEN_C, rect[0], r, 0)
                             middle_key = 0
                         else:
-                            pygame.draw.circle(root, PEN_C, rect[0], PEN_THICKNESS * 2, 0)
-                    elif middle_key == 13:#画圆线框模式
+                            pygame.draw.circle(
+                                root, PEN_C, rect[0], PEN_THICKNESS * 2, 0)
+                    elif middle_key == 13:  # 画圆线框模式
                         rect.append(event.pos)
                         if len(rect) == 2:
-                            r = int(((rect[0][0] - rect[1][0]) ** 2 + (rect[0][1] - rect[1][1]) ** 2) ** (1 / 2))#两点间求距离
-                            pygame.draw.circle(root, PEN_C, rect[0], r, PEN_THICKNESS)
+                            # 两点间求距离
+                            r = int(
+                                ((rect[0][0] - rect[1][0]) ** 2 + (rect[0][1] - rect[1][1]) ** 2) ** (1 / 2))
+                            pygame.draw.circle(
+                                root, PEN_C, rect[0], r, PEN_THICKNESS)
                             middle_key = 0
                         else:
-                            pygame.draw.circle(root, PEN_C, rect[0], PEN_THICKNESS, 0)
+                            pygame.draw.circle(
+                                root, PEN_C, rect[0], PEN_THICKNESS, 0)
                     elif middle_key == 14:  # 画多边形模式
                         line.append(event.pos)
                         if len(line) == 2:
-                            pygame.draw.line(root, PEN_C, line[0], line[1], PEN_THICKNESS)
+                            pygame.draw.line(
+                                root, PEN_C, line[0], line[1], PEN_THICKNESS)
                             del line[0]
                         poly.append(event.pos)
-                    elif middle_key == 15:#画椭圆模式
+                    elif middle_key == 15:  # 画椭圆模式
                         rect.append(event.pos)
                         if len(rect) == 2:
                             x = [rect[0][0], rect[1][0]]
                             y = [rect[0][1], rect[1][1]]
-                            x.sort();y.sort()
-                            pygame.draw.ellipse(root, PEN_C, [x[0], y[0], x[1] - x[0], y[1] - y[0]], 0)
+                            x.sort()
+                            y.sort()
+                            pygame.draw.ellipse(
+                                root, PEN_C, [
+                                    x[0], y[0], x[1] - x[0], y[1] - y[0]], 0)
                             middle_key = 0
-                    elif middle_key == 16:#画椭圆边框模式
+                    elif middle_key == 16:  # 画椭圆边框模式
                         rect.append(event.pos)
                         if len(rect) == 2:
                             x = [rect[0][0], rect[1][0]]
                             y = [rect[0][1], rect[1][1]]
-                            x.sort();y.sort()
-                            pygame.draw.ellipse(root, PEN_C, [x[0], y[0], x[1] - x[0], y[1] - y[0]], PEN_THICKNESS)
+                            x.sort()
+                            y.sort()
+                            pygame.draw.ellipse(
+                                root, PEN_C, [
+                                    x[0], y[0], x[1] - x[0], y[1] - y[0]], PEN_THICKNESS)
                             middle_key = 0
                 elif event.button == 1:
                     Tip[2] = 1
-                    pygame.draw.circle(root, PEN_C, event.pos, PEN_THICKNESS, 0)
+                    pygame.draw.circle(
+                        root, PEN_C, event.pos, PEN_THICKNESS, 0)
                     m_x = event.pos[0]
                     m_y = event.pos[1]
-            elif event.type == KEYDOWN:#键盘按下(长按不算)快捷键
-                if event.key == K_d:#不用点击左键画线
+            elif event.type == KEYDOWN:  # 键盘按下(长按不算)快捷键
+                if event.key == K_d:  # 不用点击左键画线
                     if continuous_draw:
                         continuous_draw = False
                     else:
                         continuous_draw = True
                         m_x = None
                         m_y = None
-                elif event.key == K_g:#画直线
+                elif event.key == K_g:  # 画直线
                     tips = '根据两个端点画直线'
                     middle_key = 2
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_f:#画矩阵
+                elif event.key == K_f:  # 画矩阵
                     middle_key = 3
                     tips = '根据两个相对的顶点绘制矩形'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_s:#画矩阵边框
+                elif event.key == K_s:  # 画矩阵边框
                     middle_key = 4
                     tips = '根据两个相对的顶点绘制矩形'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_k:#画横线
+                elif event.key == K_k:  # 画横线
                     middle_key = 5
                     tips = '选择起点和与终点y坐标相同的点'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_l:#画竖线
+                elif event.key == K_l:  # 画竖线
                     middle_key = 6
                     tips = '选择起点和与终点x坐标相同的点'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_j:#多段线
+                elif event.key == K_j:  # 多段线
                     if middle_key == 7:
                         middle_key = 0
                     else:
@@ -491,7 +612,7 @@ def draw_main(dis_x=900, dis_y=700):
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_i:#多段线横线打点
+                elif event.key == K_i:  # 多段线横线打点
                     if middle_key == 8:
                         middle_key = 0
                     else:
@@ -500,7 +621,7 @@ def draw_main(dis_x=900, dis_y=700):
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_u:#多段线竖线打点
+                elif event.key == K_u:  # 多段线竖线打点
                     if middle_key == 9:
                         middle_key = 0
                     else:
@@ -509,7 +630,7 @@ def draw_main(dis_x=900, dis_y=700):
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_h:#多段横竖线打点
+                elif event.key == K_h:  # 多段横竖线打点
                     if middle_key == 10:
                         middle_key = 0
                     else:
@@ -518,30 +639,30 @@ def draw_main(dis_x=900, dis_y=700):
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_q:#绘制虚线
+                elif event.key == K_q:  # 绘制虚线
                     middle_key = 11
                     tips = '选择虚线的两个端点'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_c:#绘制圆形
+                elif event.key == K_c:  # 绘制圆形
                     middle_key = 12
                     tips = '选择圆形和圆上任意一点(确定半径)'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_v:#绘制圆形线框
+                elif event.key == K_v:  # 绘制圆形线框
                     middle_key = 13
                     tips = '选择圆形和圆上任意一点(确定半径)'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_o:#捕捉
+                elif event.key == K_o:  # 捕捉
                     tips = '起点已经捕捉到坐标系原点了'
-                    line=[[XY_x, XY_y]]
-                    rect=[[XY_x, XY_y]]
-                    poly=[[XY_x, XY_y]]
-                elif event.key == K_y:#捕捉上y轴
+                    line = [[XY_x, XY_y]]
+                    rect = [[XY_x, XY_y]]
+                    poly = [[XY_x, XY_y]]
+                elif event.key == K_y:  # 捕捉上y轴
                     if len(line) >= 1:
                         tips = '起点已经移动到坐标系y轴上了'
                         line[0][0] = XY_x
@@ -551,7 +672,7 @@ def draw_main(dis_x=900, dis_y=700):
                     if len(poly) >= 1:
                         tips = '起点已经移动到坐标系y轴上了'
                         rect[0][0] = XY_x
-                elif event.key == K_x:#捕捉上x轴
+                elif event.key == K_x:  # 捕捉上x轴
                     if len(line) >= 1:
                         tips = '起点已经移动到坐标系x轴上了'
                         line[0][1] = XY_y
@@ -561,14 +682,14 @@ def draw_main(dis_x=900, dis_y=700):
                     if len(poly) >= 1:
                         tips = '起点已经移动到坐标系x轴上了'
                         rect[0][1] = XY_y
-                elif event.key == K_n: # 画多边形
+                elif event.key == K_n:  # 画多边形
                     if middle_key == 14:
                         middle_key = 0
                         pygame.draw.polygon(root, PEN_C, poly, 0)
                     else:
                         tips = '依次选择多边形的各个端点(点击n闭合并填充)'
                         middle_key = 14
-                elif event.key == K_m: # 画多边形边框
+                elif event.key == K_m:  # 画多边形边框
                     if middle_key == 14:
                         middle_key = 0
                         pygame.draw.polygon(root, PEN_C, poly, PEN_THICKNESS)
@@ -578,22 +699,22 @@ def draw_main(dis_x=900, dis_y=700):
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_e:#绘制填充椭圆
+                elif event.key == K_e:  # 绘制填充椭圆
                     middle_key = 15
                     tips = '选择椭圆外界矩形的两个相对的顶点'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_r:#绘制椭圆边框
+                elif event.key == K_r:  # 绘制椭圆边框
                     middle_key = 16
                     tips = '选择椭圆外界矩形的两个相对的顶点'
                     line = []
                     rect = []
                     poly = []
-                elif event.key == K_w:#保存
+                elif event.key == K_w:  # 保存
                     if BC_Dic != '':
                         pygame.image.save(root, BC_Dic)  # 保存当前环境
-                elif event.key == K_b:#清空当前操作
+                elif event.key == K_b:  # 清空当前操作
                     middle_key = 0
                     line = []
                     rect = []
@@ -621,4 +742,4 @@ def draw_main(dis_x=900, dis_y=700):
 # y-捕捉坐标y轴(同上)
 # b-关闭当前所有快捷键操作
 # e-绘制填充椭圆
-# r-绘制椭圆边框
+# r-绘制椭圆边框

文件差异内容过多而无法显示
+ 384 - 232
Crawler/Crawler_controller.py


+ 30 - 22
Crawler/Information_storage.py

@@ -1,10 +1,11 @@
 import os
 import time
 
+
 class Database:
-    def __init__(self,name):
-        self.dir = rf'{os.getcwd()}/Database_dir/{name}.cotanDB'#创建DB文件
-        self.file = open(self.dir,'r+' if os.path.exists(self.dir) else 'w+')
+    def __init__(self, name):
+        self.dir = rf'{os.getcwd()}/Database_dir/{name}.cotanDB'  # 创建DB文件
+        self.file = open(self.dir, 'r+' if os.path.exists(self.dir) else 'w+')
         self.id = 0
         self.name = name
         for _ in self.file.readlines():
@@ -16,10 +17,10 @@ class Database:
     def close(self):
         try:
             self.file.close()
-        except:
+        except BaseException:
             pass
 
-    def add_new(self,data):
+    def add_new(self, data):
         data_str = str(self.id)
         for i in data:
             data_str += ',' + str(i)
@@ -32,55 +33,62 @@ class Database:
         self.file.close()
         os.remove(self.dir)
 
-    def out_file(self,out_dir):
-        with open(out_dir + fr'/{self.name}.contanDB','w') as f:
+    def out_file(self, out_dir):
+        with open(out_dir + fr'/{self.name}.contanDB', 'w') as f:
             with open(self.dir) as g:
                 f.write(g.read())
 
-class DataBase_Home:# data base控制器
+
+class DataBase_Home:  # data base控制器
     def __init__(self):
         self.database = {}
 
-    def add_DataBase(self,name):# 添加数据表
+    def add_DataBase(self, name):  # 添加数据表
         self.database[name] = Database(name)
 
-    def add_new(self,name,data):# 添加新内容
+    def add_new(self, name, data):  # 添加新内容
         database = self.database.get(name)
-        if database == None:
+        if database is None:
             self.add_DataBase(name)
             database = self.database.get(name)
         database.add_new(data)
 
-    def close(self,name):# 关闭数据表
+    def close(self, name):  # 关闭数据表
         try:
             self.database[name].close()
             del self.database[name]
-        except:
+        except BaseException:
             pass
 
-    def close_all(self):# 关闭所有数据表
+    def close_all(self):  # 关闭所有数据表
         for i in self.database:
             self.database[i].close()
         self.database = {}
 
-    def rm_dataBase(self,name):# 删除数据表
+    def rm_dataBase(self, name):  # 删除数据表
         self.database[name].remove()
         del self.database[name]
 
-    def out(self,name,dir):# 输出数据表
+    def out(self, name, dir):  # 输出数据表
         self.database[name].out_file(dir)
 
     def return_database(self):
         return list(self.database.keys())
 
+
 class log:
-    def __init__(self,log_dir):
+    def __init__(self, log_dir):
         self.log_dir = log_dir
-        self.log_file = open(log_dir + '/log.coTanLog','r+' if os.path.exists(log_dir + 'log.coTanLog') else 'w+')
-
-    def write(self,data):
-        self.log_file.write(f"[{time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))}] " + data + '\n')
+        self.log_file = open(log_dir +
+                             '/log.coTanLog', 'r+' if os.path.exists(log_dir +
+                                                                     'log.coTanLog') else 'w+')
+
+    def write(self, data):
+        self.log_file.write(
+            f"[{time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))}] " +
+            data +
+            '\n')
         self.log_file.flush()
 
     def close(self):
-        self.log_file.close()
+        self.log_file.close()

文件差异内容过多而无法显示
+ 2454 - 551
Crawler/Web_Crawler.py


+ 261 - 193
DSGC/Algebra.py

@@ -1,17 +1,18 @@
 from sympy import *
-from sympy.plotting import plot3d,plot
+from sympy.plotting import plot3d, plot
+
 
 class Algebra_base:
-    def __init__(self,new=lambda x:x):
-        self.Name = {'self':self}#命名空间
+    def __init__(self, new=lambda x: x):
+        self.Name = {'self': self}  # 命名空间
         self.Name.update(globals())
         self.Name.update(locals())
         self.Algebra_dict = {}
-        self.Algebra_dict_View = {}#门面
-        self.Symbol_MS = {}#描述文件
+        self.Algebra_dict_View = {}  # 门面
+        self.Symbol_MS = {}  # 描述文件
         self.Take_News = new
 
-    def Draw_Core(self,f):
+    def Draw_Core(self, f):
         print(f'alg = {f}')
         re = []
         try:
@@ -27,7 +28,7 @@ class Algebra_base:
                         print(f'Qre = {re}')
                     else:
                         raise Exception
-                except:
+                except BaseException:
                     a = self.Draw_Core(args[0])
                     b = self.Draw_Core(args[1])
                     re.append(['B', a, b])
@@ -39,14 +40,16 @@ class Algebra_base:
                 a = 0
                 for i in args:
                     get = self.Draw_Core(i)
-                    if a != 0:re.append(['A', ' + '])
+                    if a != 0:
+                        re.append(['A', ' + '])
                     re += get
                     a += 1
             elif name == 'Mul':
                 a = 0
                 for i in args:
                     get = self.Draw_Core(i)
-                    if a != 0:re.append(['A', ' × '])
+                    if a != 0:
+                        re.append(['A', ' × '])
                     re += get
                     a += 1
             elif name == 'Rational':
@@ -56,58 +59,70 @@ class Algebra_base:
                 re.append(['D', a, b])
             # elif name in ['Symbol', 'One', 'Zero', 'NegativeOne', 'Float', 'Rational', 'Half']:
             #     raise Exception
-            elif len(args)<1:
+            elif len(args) < 1:
                 raise Exception
-            else:#增添逗号
+            else:  # 增添逗号
                 re.append(['A', f'{str(name)}( '])
                 a = 0
                 for i in args:
                     get = self.Draw_Core(i)
-                    if a != 0:re.append(['A', ' , '])
+                    if a != 0:
+                        re.append(['A', ' , '])
                     re += get
                     a += 1
                 re.append(['A', ' )'])
             print(f'bRe={re}')
             return re
-        except:
+        except BaseException:
             a = str(f)
             try:
                 if a[0] == '-':
                     a = f'({a})'
-            except:pass
+            except BaseException:
+                pass
             re.append(['A', a])
             return re
 
-    def Simplify(self,alg,radio=1.7,func=None,rat=True,inv=False):#函数简化
-        if func == None:func = count_ops
+    def Simplify(self, alg, radio=1.7, func=None, rat=True, inv=False):  # 函数简化
+        if func is None:
+            func = count_ops
         try:
             self.Take_News('正在标准化')
-            return simplify(alg,ratio=radio,func=func,rational=rat,inverse=inv)
-        except:
+            return simplify(
+                alg,
+                ratio=radio,
+                func=func,
+                rational=rat,
+                inverse=inv)
+        except BaseException:
             return None
 
-    def rprint_expression(self,e, level=0, First=True):#直接打印
-        e = simplify(e)#转换为sympy可以执行的对象
-        return self.print_expression_core(e,level,First)
+    def rprint_expression(self, e, level=0, First=True):  # 直接打印
+        e = simplify(e)  # 转换为sympy可以执行的对象
+        return self.print_expression_core(e, level, First)
 
-    def print_expression_core(self,e, level=0, First=True,q = 1):#递归
+    def print_expression_core(self, e, level=0, First=True, q=1):  # 递归
         str_print = ' ' * level
-        if First: str_print = f'[{e}]\n' + str_print
+        if First:
+            str_print = f'[{e}]\n' + str_print
         try:
             name = e.func.__name__
             args = e.args
-            if args == (): raise Exception
-            if name == 'log':name = 'ln'
+            if args == ():
+                raise Exception
+            if name == 'log':
+                name = 'ln'
             str_print += f'({q}){name}\n'
             n = len(name)
             for i in args:
                 self.Take_News('正在迭代运算中')
-                str_print += self.print_expression_core(i, level + n, First=False,q = q + 1)
+                str_print += self.print_expression_core(
+                    i, level + n, First=False, q=q + 1)
             return str_print
-        except:
+        except BaseException:
             return str_print + f'({q}){str(e)}\n'
 
-    def Split_Func_core(self,e,deep,f,first=True):#递归
+    def Split_Func_core(self, e, deep, f, first=True):  # 递归
         try:
             name = e.func.__name__
             args = e.args
@@ -123,36 +138,37 @@ class Algebra_base:
                     re = []
                 for i in args:
                     self.Take_News('正在迭代运算中')
-                    get = self.Split_Func_core(i, deep, f,False)
+                    get = self.Split_Func_core(i, deep, f, False)
                     re += get
                 return re
             else:
                 return args
-        except:
+        except BaseException:
             return [e]
 
-    def Merge_Func_Core(self,name_list,Func):
+    def Merge_Func_Core(self, name_list, Func):
         if len(name_list) < 2:
             return None
         st = name_list[0]
         for n in name_list[1:]:
-            st = Func(st,n)
+            st = Func(st, n)
         return st
 
-    def Creat_Num(self,num,num_type):
+    def Creat_Num(self, num, num_type):
         try:
-            if num_type == 0:#浮点数
+            if num_type == 0:  # 浮点数
                 return Float(num)
-            elif num_type == 1:#整数
+            elif num_type == 1:  # 整数
                 return Integer(num)
-            elif num_type == 2:#有理数
+            elif num_type == 2:  # 有理数
                 n = num.split('/')
-                return Rational(n[0],n[1])
+                return Rational(n[0], n[1])
             else:
-                return sympify(num,locals=self.Name)
-        except:
+                return sympify(num, locals=self.Name)
+        except BaseException:
             return Integer(1)
 
+
 class Algebra_Polynomial(Algebra_base):
     def __call__(self):
         alg_view = []
@@ -165,60 +181,66 @@ class Algebra_Polynomial(Algebra_base):
         for name in self.Symbol_MS:
             value.append(name)
             value_view.append(f'符号:{name} --> {self.Symbol_MS[name]}')
-        return (value_view,value),(alg_view,alg)
+        return (value_view, value), (alg_view, alg)
 
-    def del_Symbol(self,x):
+    def del_Symbol(self, x):
         del self.Symbol_MS[x]
         del self.Name[x]
 
-    def addSymbol(self,name,AT=0,RI=0,PC=0,EO=0,FI=0,CIR=None,NZ=None,INT=0,NONE=0,ms='自定义符号'):#创建符号(ms=描述)
+    def addSymbol(self, name, AT=0, RI=0, PC=0, EO=0, FI=0, CIR=None, NZ=None, INT=0, NONE=0, ms='自定义符号'):  # 创建符号(ms=描述)
         k = {}
         try:
-            name = name.replace(' ','')
-            exec(f'{name} = 5',{})#测试name有没有做符号名字的资质
-            if NONE == 1:raise Exception
-            if AT == 1:#代数
+            name = name.replace(' ', '')
+            exec(f'{name} = 5', {})  # 测试name有没有做符号名字的资质
+            if NONE == 1:
+                raise Exception
+            if AT == 1:  # 代数
                 k['algebraic'] = True
-            elif AT == 2:#超越数
+            elif AT == 2:  # 超越数
                 k['transcendental'] = True
-            if RI == 1:#有理数
+            if RI == 1:  # 有理数
                 k['rational'] = True
-            elif RI == 2:#无理数
+            elif RI == 2:  # 无理数
                 k['irrational'] = True
-            if PC == 1:#质数
+            if PC == 1:  # 质数
                 k['prime'] = True
-            elif PC == 2:#合数
+            elif PC == 2:  # 合数
                 k['composite'] = True
-            if EO == 1:#偶数
+            if EO == 1:  # 偶数
                 k['even'] = True
-            elif EO == 2:#奇数
+            elif EO == 2:  # 奇数
                 k['odd'] = True
-            if FI == 1:#有限实数
+            if FI == 1:  # 有限实数
                 k['finite'] = True
-            elif FI == 2:#无穷
+            elif FI == 2:  # 无穷
                 k['infinite'] = True
-            elif FI == 3:#广义实数
+            elif FI == 3:  # 广义实数
                 k['extended_real'] = True
             if INT == 1:
                 k['integer'] = True
-            try:#避免CIR不是list而是None
+            try:  # 避免CIR不是list而是None
                 k[CIR[0]] = CIR[1]
-            except:pass
-            try:#避免NZ不是list而是None
+            except BaseException:
+                pass
+            try:  # 避免NZ不是list而是None
                 k[NZ[0]] = NZ[1]
-            except:pass
-        except:
+            except BaseException:
+                pass
+        except BaseException:
             pass
         new_Name = self.Name.copy()
-        new_Name.update({'k':k})
+        new_Name.update({'k': k})
         try:
-            exec(f"self.Name['{name}'] = Symbol('{name}',**k)",new_Name)#创建一个Symbols
+            exec(
+                f"self.Name['{name}'] = Symbol('{name}',**k)",
+                new_Name)  # 创建一个Symbols
             self.Symbol_MS[name] = ms
             return True
-        except:
+        except BaseException:
             return False
             # raise
-    def Value_assumptions0(self,n):
+
+    def Value_assumptions0(self, n):
         value = self.Name[n]
         get = value.assumptions0
         R_T = []
@@ -230,21 +252,21 @@ class Algebra_Polynomial(Algebra_base):
                 R_F.append(f'{FY(i)} >>> {get[i]}')
         return R_T + R_F
 
-    def addAlgebra(self,name,alg):#设置代数式
+    def addAlgebra(self, name, alg):  # 设置代数式
         try:
-            name = name.replace(' ','')
+            name = name.replace(' ', '')
             try:
-                exec(f'{name}=5',{})#检查name是否符合标准
-            except:
+                exec(f'{name}=5', {})  # 检查name是否符合标准
+            except BaseException:
                 name = f'F{str(len(self.Algebra_dict))}'
-            eval(f'{alg}',self.Name)#检查
-            self.Algebra_dict[name] = sympify(alg,locals=self.Name)
+            eval(f'{alg}', self.Name)  # 检查
+            self.Algebra_dict[name] = sympify(alg, locals=self.Name)
             self.Algebra_dict_View[name] = str(alg)
             return True
-        except:
+        except BaseException:
             return False
 
-    def del_Alg(self,name):
+    def del_Alg(self, name):
         del self.Algebra_dict[name]
         del self.Algebra_dict_View[name]
 
@@ -252,17 +274,17 @@ class Algebra_Polynomial(Algebra_base):
         self.Algebra_dict = {}
         self.Algebra_dict_View = {}
 
-    def get_Algebra(self,name,str = False):
+    def get_Algebra(self, name, str=False):
         if str:
             return self.Algebra_dict_View[name]
         else:
             return self.Algebra_dict[name]
 
-    def print_expression(self,name, level=0, First=True):#根据名字打印
+    def print_expression(self, name, level=0, First=True):  # 根据名字打印
         print(name)
-        return self.print_expression_core(self.get_Algebra(name),level,First)
+        return self.print_expression_core(self.get_Algebra(name), level, First)
 
-    def Split_Mul(self,name,renum=False,reone=False):
+    def Split_Mul(self, name, renum=False, reone=False):
         alg = self.get_Algebra(name)
         r = factor(alg)
         b = list(factor_list(alg))
@@ -276,46 +298,48 @@ class Algebra_Polynomial(Algebra_base):
                         if reone:
                             raise Exception
                         else:
-                            if i == 1:continue
+                            if i == 1:
+                                continue
                     else:
                         Float(i)
                         continue  # 排除数字
-                except:
+                except BaseException:
                     pass
                 c.append(i)
-        return c,r
+        return c, r
 
-    def Split_Add(self,name,Object,f):
+    def Split_Add(self, name, Object, f):
         alg = self.get_Algebra(name)
         alg = expand(alg)
-        coll = collect(alg,Object)
-        coll_Dic = collect(alg,Object,evaluate=False)
+        coll = collect(alg, Object)
+        coll_Dic = collect(alg, Object, evaluate=False)
         if f == 0:
-            return list(coll_Dic.keys()),coll
+            return list(coll_Dic.keys()), coll
         elif f == 1:
-            return list(coll_Dic.values()),coll
+            return list(coll_Dic.values()), coll
         else:
             re = []
             for i in coll_Dic:
-                re.append(i*coll_Dic[i])
-            return re,coll
+                re.append(i * coll_Dic[i])
+            return re, coll
 
-    def Split_Func(self,name,deep,f,must = True):
+    def Split_Func(self, name, deep, f, must=True):
         alg = self.get_Algebra(name)
         if f == ['']:
             try:
-                return alg.args,alg
-            except:
-                return None,alg
+                return alg.args, alg
+            except BaseException:
+                return None, alg
         get = self.Split_Func_core(alg, deep, f)
         re = []
         if not must:
             for i in get:
                 try:
-                    if i.args != ():re.append(i)
-                except:
+                    if i.args != ():
+                        re.append(i)
+                except BaseException:
                     pass
-            return re,alg
+            return re, alg
         return get, alg
 
     def Merge_Add(self, name_list):
@@ -323,236 +347,280 @@ class Algebra_Polynomial(Algebra_base):
         for n in name_list:
             try:
                 name.append(self.get_Algebra(n))
-            except:pass
-        return self.Merge_Func_Core(name,Add)
+            except BaseException:
+                pass
+        return self.Merge_Func_Core(name, Add)
 
     def Merge_Mul(self, name_list):
         name = []
         for n in name_list:
             try:
                 name.append(self.get_Algebra(n))
-            except:pass
-        return self.Merge_Func_Core(name,Mul)
+            except BaseException:
+                pass
+        return self.Merge_Func_Core(name, Mul)
 
-    def Merge_Func(self, name_list,f):
+    def Merge_Func(self, name_list, f):
         name = []
         func = self.Name[f]
         for n in name_list:
             try:
                 name.append(self.get_Algebra(n))
-            except:pass
-        return self.Merge_Func_Core(name,func)
+            except BaseException:
+                pass
+        return self.Merge_Func_Core(name, func)
 
-    def Fractional_merge(self,name):#最小公分母合并
+    def Fractional_merge(self, name):  # 最小公分母合并
         alg = self.get_Algebra(name)
         return ratsimp(alg)
 
-    def Fraction_reduction(self,name):#分式化简
+    def Fraction_reduction(self, name):  # 分式化简
         alg = self.get_Algebra(name)
         return cancel(alg)
 
-    def Fractional_fission(self,name,x):#分式裂项
+    def Fractional_fission(self, name, x):  # 分式裂项
         x = self.Name[x]
         alg = self.get_Algebra(name)
-        return apart(alg,x)
+        return apart(alg, x)
 
-    def as_Fraction(self,name,deep):#合成分式
+    def as_Fraction(self, name, deep):  # 合成分式
         alg = self.get_Algebra(name)
-        return together(alg,deep)
+        return together(alg, deep)
 
-    def Fractional_rat(self,name,s,Max):#分母有理化
+    def Fractional_rat(self, name, s, Max):  # 分母有理化
         alg = self.get_Algebra(name)
-        return radsimp(alg,s,Max)
+        return radsimp(alg, s, Max)
 
-    def Trig_Simp(self,name):#三角化简
+    def Trig_Simp(self, name):  # 三角化简
         alg = self.get_Algebra(name)
         return trigsimp(alg)
 
-    def Trig_Expansion(self,name,deep):#三角化简
+    def Trig_Expansion(self, name, deep):  # 三角化简
         alg = self.get_Algebra(name)
-        return expand_trig(alg,deep)
+        return expand_trig(alg, deep)
 
-    def Mul_Expansion(self,name):
+    def Mul_Expansion(self, name):
         alg = self.get_Algebra(name)
         return expand_mul(alg)
 
-    def Multinomial_Expansion(self,name):
+    def Multinomial_Expansion(self, name):
         alg = self.get_Algebra(name)
         return expand_multinomial(alg)
 
-    def Pow_Simp_Multinomial(self,name):
+    def Pow_Simp_Multinomial(self, name):
         alg = self.get_Algebra(name)
         return powdenest(alg)
 
-    def Pow_Simp_base(self,name,JS):#处理底数
-        return self.Pow_Simp(name,JS,'base')
+    def Pow_Simp_base(self, name, JS):  # 处理底数
+        return self.Pow_Simp(name, JS, 'base')
 
-    def Pow_Simp_exp(self,name,JS):#处理指数
-        return self.Pow_Simp(name,JS,'exp')
+    def Pow_Simp_exp(self, name, JS):  # 处理指数
+        return self.Pow_Simp(name, JS, 'exp')
 
-    def Pow_Simp(self,name,JS,combine='all'):#均处理
+    def Pow_Simp(self, name, JS, combine='all'):  # 均处理
         alg = self.get_Algebra(name)
-        return powsimp(alg,force=JS,combine=combine)
+        return powsimp(alg, force=JS, combine=combine)
 
-    def Pow_Expansion_base(self,name,deep):
+    def Pow_Expansion_base(self, name, deep):
         alg = self.get_Algebra(name)
-        return expand_power_base(alg,deep)
+        return expand_power_base(alg, deep)
 
-    def Pow_Expansion_exp(self,name,deep):
+    def Pow_Expansion_exp(self, name, deep):
         alg = self.get_Algebra(name)
-        return expand_power_exp(alg,deep)
+        return expand_power_exp(alg, deep)
 
-    def Pow_Expansion(self,name,deep):
+    def Pow_Expansion(self, name, deep):
         alg = self.get_Algebra(name)
-        return expand(alg,deep=deep, log=False, mul=False,
-        power_exp=True, power_base=True, multinomial=True,
-        basic=False)
+        return expand(alg, deep=deep, log=False, mul=False,
+                      power_exp=True, power_base=True, multinomial=True,
+                      basic=False)
 
-    def log_Simp(self,name,fo):
+    def log_Simp(self, name, fo):
         alg = self.get_Algebra(name)
-        return logcombine(alg,fo)
+        return logcombine(alg, fo)
 
-    def log_Expansion(self,name,deep,fo):
+    def log_Expansion(self, name, deep, fo):
         alg = self.get_Algebra(name)
-        return expand_log(alg,deep,fo)
+        return expand_log(alg, deep, fo)
 
-    def simplify(self,name,ratdio=1.7,func=None,rat=True,inv=False):
+    def simplify(self, name, ratdio=1.7, func=None, rat=True, inv=False):
         alg = self.get_Algebra(name)
-        self.Simplify(alg,ratdio,func,rat,inv)
+        self.Simplify(alg, ratdio, func, rat, inv)
 
-    def expansion(self,name,IM):
+    def expansion(self, name, IM):
         alg = self.get_Algebra(name)
-        return expand(alg,complex=IM)
+        return expand(alg, complex=IM)
 
-    def factor(self,name,M,GS,Deep,Rat):
+    def factor(self, name, M, GS, Deep, Rat):
         k = {}
-        if M != None:k['modulus']=M
-        if GS:k['gaussian']=True
+        if M is not None:
+            k['modulus'] = M
+        if GS:
+            k['gaussian'] = True
         alg = self.get_Algebra(name)
-        return factor(alg,deep = Deep,fraction=Rat,**k)
+        return factor(alg, deep=Deep, fraction=Rat, **k)
 
-    def Collect(self,name,x):
+    def Collect(self, name, x):
         alg = self.get_Algebra(name)
         try:
-            return collect(alg,x)
-        except:
+            return collect(alg, x)
+        except BaseException:
             return ceiling(alg)
 
-    def complex_Ex(self,name):
+    def complex_Ex(self, name):
         alg = self.get_Algebra(name)
         return expand_complex(alg)
 
-    def func_Ex(self,name):
+    def func_Ex(self, name):
         alg = self.get_Algebra(name)
         return expand_func(alg)
 
-    def to_num(self,name,n):
+    def to_num(self, name, n):
         alg = self.get_Algebra(name)
         return alg.evalf(n)
 
-    def Sub_Value(self,name,Dic):
+    def Sub_Value(self, name, Dic):
         alg = self.get_Algebra(name)
-        sympy_Dic = {}#
-        for i in Dic:#i是符号,Dic[i]是代数式名字
+        sympy_Dic = {}
+        for i in Dic:  # i是符号,Dic[i]是代数式名字
             try:
-                v_alg = self.get_Algebra(Dic[i])#获得代数式
-                get = self.Name[i]#处理符号
+                v_alg = self.get_Algebra(Dic[i])  # 获得代数式
+                get = self.Name[i]  # 处理符号
                 sympy_Dic[get] = v_alg
-            except:pass
+            except BaseException:
+                pass
         return alg.subs(sympy_Dic)
 
-    def RSub_Value(self,name,Dic):
+    def RSub_Value(self, name, Dic):
         alg = self.get_Algebra(name)
         sympy_Dic = {}
-        for i in Dic:#i是代数式名字,Dic[i]是符号
+        for i in Dic:  # i是代数式名字,Dic[i]是符号
             try:
-                v_alg = self.get_Algebra(i)#获得代数式
-                get = self.Name[Dic[i]]#处理符号
+                v_alg = self.get_Algebra(i)  # 获得代数式
+                get = self.Name[Dic[i]]  # 处理符号
                 sympy_Dic[v_alg] = get
-            except:pass
+            except BaseException:
+                pass
         return alg.subs(sympy_Dic)
 
-    def SubNum_Value(self,name,Dic):
+    def SubNum_Value(self, name, Dic):
         alg = self.get_Algebra(name)
         sympy_Dic = {}
-        for i in Dic:#i是符号,Dic[i]是数字
+        for i in Dic:  # i是符号,Dic[i]是数字
             try:
-                get = self.Name[i]#处理符号
+                get = self.Name[i]  # 处理符号
                 sympy_Dic[get] = Dic[i]
-            except:pass
+            except BaseException:
+                pass
         return alg.subs(sympy_Dic)
 
-    def Solve(self,alg_list):
+    def Solve(self, alg_list):
         alg = []
         x_list = set()
         for i in alg_list:
             z = self.get_Algebra(i[0])
             y = self.get_Algebra(i[1])
-            alg.append(Eq(z,y))
-            x_list = x_list|alg[-1].atoms(Symbol)
+            alg.append(Eq(z, y))
+            x_list = x_list | alg[-1].atoms(Symbol)
         x_list = list(x_list)
         re = []
-        for x in x_list:#遍历原子
-            get = solve(alg,x,dict=True)
-            for i in get:#遍历答案
+        for x in x_list:  # 遍历原子
+            get = solve(alg, x, dict=True)
+            for i in get:  # 遍历答案
                 for a in i:
-                    re.append((a,i[a]))
+                    re.append((a, i[a]))
         return re
 
-    def Solve_Inequality(self,alg_list,Type_Num):
-        Type = ['>','<','>=','<='][Type_Num]
+    def Solve_Inequality(self, alg_list, Type_Num):
+        Type = ['>', '<', '>=', '<='][Type_Num]
         z = self.get_Algebra(alg_list[0])
         y = self.get_Algebra(alg_list[1])
-        f = sympify(f'{z} {Type} {y}',locals=self.Name)
+        f = sympify(f'{z} {Type} {y}', locals=self.Name)
         print(f)
         answer = solve(f)
-        if answer == True:
+        if answer:
             return ['恒成立']
         elif answer == False:
             return ['恒不成立']
-        get = self.Split_Func_core(answer,1,('Or'))
+        get = self.Split_Func_core(answer, 1, ('Or'))
         return get
 
-    def Rewrite(self,name,Func,DX,deep=False):
+    def Rewrite(self, name, Func, DX, deep=False):
         alg = self.get_Algebra(name)
-        f = sympify(Func,locals=self.Name)#重新函数
+        f = sympify(Func, locals=self.Name)  # 重新函数
         if DX != []:
             ff = []  # 重写对象
             for i in DX:
-                ff.append(sympify(i,locals=self.Name))
+                ff.append(sympify(i, locals=self.Name))
             return alg.rewrite(ff, f, deep=deep)
         else:
             return alg.rewrite(f, deep=deep)
 
-    def Plot(self,name,list_2D,list_3D = None):
+    def Plot(self, name, list_2D, list_3D=None):
         list_2D = list_2D.copy()
         alg = self.get_Algebra(name)
         list_2D[0] = self.Name[list_2D[0]]
-        if list_3D == None:
+        if list_3D is None:
             self.Take_News('正在绘制图像')
-            plot(alg, tuple(list_2D),xlabel=f'{list_2D[0]}',ylabel=f'{alg}',title='CoTan Algebra')
+            plot(
+                alg,
+                tuple(list_2D),
+                xlabel=f'{list_2D[0]}',
+                ylabel=f'{alg}',
+                title='CoTan Algebra')
         else:
             list_3D = list_3D.copy()
             list_3D[0] = self.Name[list_3D[0]]
             self.Take_News('正在绘制图像')
-            plot3d(alg, tuple(list_2D),tuple(list_3D), xlabel=f'{list_2D[0]}', ylabel=f'{list_3D[0]}',zlable=f'{alg}',title='CoTan Algebra')
+            plot3d(
+                alg,
+                tuple(list_2D),
+                tuple(list_3D),
+                xlabel=f'{list_2D[0]}',
+                ylabel=f'{list_3D[0]}',
+                zlable=f'{alg}',
+                title='CoTan Algebra')
 
-    def Draw(self,name):
+    def Draw(self, name):
         alg = self.get_Algebra(name)
         return self.Draw_Core(alg)
 
-#提供翻译服务
+# 提供翻译服务
+
+
 def FY(word):
-    book = {'algebraic':'代数','transcendental':'超越数','rational':'有理数','irrational':'无理数',
-            'odd':'奇数','even':'偶数','negative':'负数','positive':'正数','zero':'零',
-            'complex':'复数','imaginary':'虚数','real':'实数','integer':'整数','prime':'质数',
-            'composite':'合数','finite':'有限数字','infinite':'无穷','extended_real':'广义实数',
-            'commutative':'满足交换律','hermitian':'厄米特矩阵','nonnegative':'非负数',
-            'nonpositive':'非正数','nonzero':'非零实数','noninteger':'非整数','extended_nonzero':'广义非零数',
-            'extended_negative':'广义负数','extended_nonpositive':'广义非正数','extended_nonnegative':'广义非负数',
-            'extended_positive':'广义正数'}
+    book = {
+        'algebraic': '代数',
+        'transcendental': '超越数',
+        'rational': '有理数',
+        'irrational': '无理数',
+        'odd': '奇数',
+        'even': '偶数',
+        'negative': '负数',
+        'positive': '正数',
+        'zero': '零',
+        'complex': '复数',
+        'imaginary': '虚数',
+        'real': '实数',
+        'integer': '整数',
+        'prime': '质数',
+        'composite': '合数',
+        'finite': '有限数字',
+        'infinite': '无穷',
+        'extended_real': '广义实数',
+        'commutative': '满足交换律',
+        'hermitian': '厄米特矩阵',
+        'nonnegative': '非负数',
+        'nonpositive': '非正数',
+        'nonzero': '非零实数',
+        'noninteger': '非整数',
+        'extended_nonzero': '广义非零数',
+        'extended_negative': '广义负数',
+        'extended_nonpositive': '广义非正数',
+        'extended_nonnegative': '广义非负数',
+        'extended_positive': '广义正数'}
     try:
         CN = book[word]
         return f'{CN}({word})'
-    except:
-        return word
+    except BaseException:
+        return word

文件差异内容过多而无法显示
+ 346 - 215
DSGC/Algebra_Systemctl.py


文件差异内容过多而无法显示
+ 398 - 228
Data_Science/Learn.py


文件差异内容过多而无法显示
+ 1894 - 342
Data_Science/Me_learn.py


文件差异内容过多而无法显示
+ 1071 - 161
Git_controller/GIT.py


+ 363 - 199
Git_controller/Git_Ctrl.py

@@ -1,41 +1,51 @@
 # -*- coding: <encoding name> -*-
 from git import Repo
-from os.path import split,exists
+from os.path import split, exists
 import os
 import subprocess
 from time import time
 import random
 
-sys_seeting = dict(shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,universal_newlines=True)
-git_path = 'git'# git的地址,如果配置了环境变量则不需要修改
-stopKey = '【操作完成】'#存储stopKey的global变量
-passwd = '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'#stopKey的候选词库
+sys_seeting = dict(
+    shell=True,
+    stdin=subprocess.PIPE,
+    stdout=subprocess.PIPE,
+    stderr=subprocess.STDOUT,
+    universal_newlines=True)
+git_path = 'git'  # git的地址,如果配置了环境变量则不需要修改
+stopKey = '【操作完成】'  # 存储stopKey的global变量
+passwd = '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'  # stopKey的候选词库
 
-class git_Repo:#git的基类
-    def __init__(self,Dic,*args,**kwargs):
+
+class git_Repo:  # git的基类
+    def __init__(self, Dic, *args, **kwargs):
         self.url = None
         try:
             if exists(Dic + r'/.git'):  # 是否为git 仓库
                 pass
-            elif Dic[-4:] =='.git':
+            elif Dic[-4:] == '.git':
                 Dic = Dic[:-5]  # -5,得把/去掉
-            else:raise Exception
-        except:
-            subprocess.Popen(f'{git_path} init',cwd=self.Repo_Dic,**sys_seeting).wait()
+            else:
+                raise Exception
+        except BaseException:
+            subprocess.Popen(
+                f'{git_path} init',
+                cwd=self.Repo_Dic,
+                **sys_seeting).wait()
         self.Repo_Dic = Dic  # 仓库地址(末尾不带/)
         self.repo = Repo(Dic)
         self.name = split(Dic)[-1]
         self.have_clone = True
 
-    def make_stopKey(self):#生成一个随机stopKey
-        global stopKey,passwd
+    def make_stopKey(self):  # 生成一个随机stopKey
+        global stopKey, passwd
         code = ''
-        for _ in range(8):#八位随机数
-            code += passwd[random.randint(0, len(passwd) - 1)]#时间戳+8位随机数
-        stopKey = (str(time()) + code).replace('.','')
+        for _ in range(8):  # 八位随机数
+            code += passwd[random.randint(0, len(passwd) - 1)]  # 时间戳+8位随机数
+        stopKey = (str(time()) + code).replace('.', '')
         return stopKey
 
-    def Flie_List(self,file_list,is_file=True,pat=' '):
+    def Flie_List(self, file_list, is_file=True, pat=' '):
         if file_list == '.':
             file = '..'
         else:
@@ -43,33 +53,47 @@ class git_Repo:#git的基类
             for i in file_list:
                 if i[:len(self.Repo_Dic)] == self.Repo_Dic:
                     file_.append(i[len(self.Repo_Dic) + 1:])  # +1是为了去除/
-            if not is_file:return file_
+            if not is_file:
+                return file_
             file = pat.join(file_)
         return file
 
-    def dir_list(self,all=True):
+    def dir_list(self, all=True):
         listfile = []
         if all:
-            listfile += [f'[当前分支] {self.repo.active_branch} 工作区{"不" if self.repo.is_dirty() else ""}干净 -> {self.name}']
+            listfile += [
+                f'[当前分支] {self.repo.active_branch} 工作区{"不" if self.repo.is_dirty() else ""}干净 -> {self.name}']
         listfile += [f'{"[配置文件]" if i == ".git" else "[未跟踪]"if i in self.repo.untracked_files else "[已跟踪]"} {i}'
                      for i in os.listdir(self.Repo_Dic)]
         return listfile
 
-    def Add_File(self,file_list):
+    def Add_File(self, file_list):
         file = self.Flie_List(file_list)
-        return subprocess.Popen(f'echo 添加文件... && {git_path} add {file} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+        return subprocess.Popen(
+            f'echo 添加文件... && {git_path} add {file} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Reset_File(self,file_list):
+    def Reset_File(self, file_list):
         file = self.Flie_List(file_list)
-        return subprocess.Popen(f'echo 撤销文件... && {git_path} rm --cached {file} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+        return subprocess.Popen(
+            f'echo 撤销文件... && {git_path} rm --cached {file} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Commit_File(self,m):
-        return subprocess.Popen(f'echo 提交文件: && {git_path} commit -m "{m}" && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+    def Commit_File(self, m):
+        return subprocess.Popen(
+            f'echo 提交文件: && {git_path} commit -m "{m}" && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Status(self):#执行status
-        return subprocess.Popen(f'echo 仓库状态: && {git_path} status && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+    def Status(self):  # 执行status
+        return subprocess.Popen(
+            f'echo 仓库状态: && {git_path} status && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Log(self,graph,pretty,abbrev):#执行log
+    def Log(self, graph, pretty, abbrev):  # 执行log
         args = ''
         if graph:
             args += ' --graph'
@@ -77,110 +101,198 @@ class git_Repo:#git的基类
             args += ' --pretty=oneline'
         if abbrev:
             args += ' --abbrev-commit'
-        return subprocess.Popen(f'echo 仓库日志: && {git_path} log{args} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+        return subprocess.Popen(
+            f'echo 仓库日志: && {git_path} log{args} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def refLog(self):#执行reflog
-        return subprocess.Popen(f'echo 操作记录: && {git_path} reflog && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+    def refLog(self):  # 执行reflog
+        return subprocess.Popen(
+            f'echo 操作记录: && {git_path} reflog && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Diff_File(self,MASTER='HEAD'):#执行diff
-        return subprocess.Popen(f'echo 文件日志: && {git_path} diff {MASTER} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+    def Diff_File(self, MASTER='HEAD'):  # 执行diff
+        return subprocess.Popen(
+            f'echo 文件日志: && {git_path} diff {MASTER} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def reset(self,HEAD='HEAD~1',Type=0):
+    def reset(self, HEAD='HEAD~1', Type=0):
         if Type == 0:
-            type_ = '--mixed'#退回到工作区
+            type_ = '--mixed'  # 退回到工作区
         elif Type == 1:
-            type_ = '--soft'#退回到暂存区
+            type_ = '--soft'  # 退回到暂存区
         else:
             type_ = '--hard'  # 退回到暂存区
-        return subprocess.Popen(f'echo 回退... && {git_path} reset {type_} {HEAD} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
-
-    def checkout(self,file_list):
-        if len(file_list) >= 1:#多于一个文件,不用--,空格
-            file = self.Flie_List(file_list,pat=' ')
-            return subprocess.Popen(f'echo 丢弃修改: && {git_path} checkout {file} && echo {self.make_stopKey()}',cwd=self.Repo_Dic,**sys_seeting)
+        return subprocess.Popen(
+            f'echo 回退... && {git_path} reset {type_} {HEAD} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
+
+    def checkout(self, file_list):
+        if len(file_list) >= 1:  # 多于一个文件,不用--,空格
+            file = self.Flie_List(file_list, pat=' ')
+            return subprocess.Popen(
+                f'echo 丢弃修改: && {git_path} checkout {file} && echo {self.make_stopKey()}',
+                cwd=self.Repo_Dic,
+                **sys_seeting)
         elif len(file_list) == 1:
-            return subprocess.Popen(f'echo 丢弃修改: && {git_path} checkout -- {file_list[0]} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+            return subprocess.Popen(
+                f'echo 丢弃修改: && {git_path} checkout -- {file_list[0]} && echo {self.make_stopKey()}',
+                cwd=self.Repo_Dic,
+                **sys_seeting)
         else:
-            return subprocess.Popen(f'echo 丢弃修改: && {git_path} checkout * && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+            return subprocess.Popen(
+                f'echo 丢弃修改: && {git_path} checkout * && echo {self.make_stopKey()}',
+                cwd=self.Repo_Dic,
+                **sys_seeting)
 
-    def rm(self,file_list):#删除版本库中的文件
+    def rm(self, file_list):  # 删除版本库中的文件
         file = self.Flie_List(file_list)
-        return subprocess.Popen(f'echo 删除... && {git_path} rm {file}', cwd=self.Repo_Dic,**sys_seeting)
+        return subprocess.Popen(
+            f'echo 删除... && {git_path} rm {file}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def check_Branch(self):#查看本地分支和远程分支
-        return subprocess.Popen(f'echo 仓库分支: && {git_path} branch -a && echo 远程仓库信息: && {git_path} remote -v && '
-                                f'echo 分支详情: && {git_path} branch -vv && echo {self.make_stopKey()}',
-                                cwd=self.Repo_Dic,**sys_seeting)
+    def check_Branch(self):  # 查看本地分支和远程分支
+        return subprocess.Popen(
+            f'echo 仓库分支: && {git_path} branch -a && echo 远程仓库信息: && {git_path} remote -v && '
+            f'echo 分支详情: && {git_path} branch -vv && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def new_Branch(self,branch_name, origin):#新建分支
-        return subprocess.Popen(f'echo 新建分支... && {git_path} branch {branch_name} {origin} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def new_Branch(self, branch_name, origin):  # 新建分支
+        return subprocess.Popen(
+            f'echo 新建分支... && {git_path} branch {branch_name} {origin} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def switch_Branch(self,branch_name):#切换分支
-        return subprocess.Popen(f'echo 切换分支... && {git_path} switch {branch_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def switch_Branch(self, branch_name):  # 切换分支
+        return subprocess.Popen(
+            f'echo 切换分支... && {git_path} switch {branch_name} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def del_Branch(self,branch_name,del_type):#删除分支
-        return subprocess.Popen(f'echo 删除分支... && {git_path} branch -{del_type} {branch_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def del_Branch(self, branch_name, del_type):  # 删除分支
+        return subprocess.Popen(
+            f'echo 删除分支... && {git_path} branch -{del_type} {branch_name} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def merge_Branch(self,branch_name,no_ff,m=''):#合并分支
-        if no_ff:no_ff = f' --no-ff -m "{m}"'#--no-ff前有空格
-        else:no_ff = ''
-        return subprocess.Popen(f'echo 合并分支... && {git_path} merge{no_ff} {branch_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def merge_Branch(self, branch_name, no_ff, m=''):  # 合并分支
+        if no_ff:
+            no_ff = f' --no-ff -m "{m}"'  # --no-ff前有空格
+        else:
+            no_ff = ''
+        return subprocess.Popen(
+            f'echo 合并分支... && {git_path} merge{no_ff} {branch_name} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def merge_abort(self):#退出冲突处理
-        return subprocess.Popen(f'echo 冲突处理退出... && {git_path} merge --abort && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def merge_abort(self):  # 退出冲突处理
+        return subprocess.Popen(
+            f'echo 冲突处理退出... && {git_path} merge --abort && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Save_stash(self):#保存工作区
-        return subprocess.Popen(f'echo 保存工作区... && {git_path} stash && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def Save_stash(self):  # 保存工作区
+        return subprocess.Popen(
+            f'echo 保存工作区... && {git_path} stash && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Stash_List(self):#工作区列表
-        return subprocess.Popen(f'echo 工作区列表: && {git_path} stash list && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def Stash_List(self):  # 工作区列表
+        return subprocess.Popen(
+            f'echo 工作区列表: && {git_path} stash list && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Apply_stash(self,stash_num = '0'):#恢复工作区
-        return subprocess.Popen(f'echo 恢复工作区... && {git_path} stash apply stash@{{{stash_num}}} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def Apply_stash(self, stash_num='0'):  # 恢复工作区
+        return subprocess.Popen(
+            f'echo 恢复工作区... && {git_path} stash apply stash@{{{stash_num}}} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Drop_stash(self,stash_num = '0'):#删除工作区
-        return subprocess.Popen(f'echo 删除工作区... && {git_path} stash drop stash@{{{stash_num}}} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def Drop_stash(self, stash_num='0'):  # 删除工作区
+        return subprocess.Popen(
+            f'echo 删除工作区... && {git_path} stash drop stash@{{{stash_num}}} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def cherry_pick(self,commit):#补丁
-        return subprocess.Popen(f'echo 补丁... && {git_path} cherry-pick {commit} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
+    def cherry_pick(self, commit):  # 补丁
+        return subprocess.Popen(
+            f'echo 补丁... && {git_path} cherry-pick {commit} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Del_remote(self,remote_name):
-        return subprocess.Popen(f'echo 删除远程仓库... && {git_path} remote remove {remote_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+    def Del_remote(self, remote_name):
+        return subprocess.Popen(
+            f'echo 删除远程仓库... && {git_path} remote remove {remote_name} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Add_remote(self,remote,remote_name):
-        return subprocess.Popen(f'echo 添加远程仓库... && {git_path} remote add {remote_name} {remote} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+    def Add_remote(self, remote, remote_name):
+        return subprocess.Popen(
+            f'echo 添加远程仓库... && {git_path} remote add {remote_name} {remote} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Bind_remote(self,local_name,remote_name):
-        return subprocess.Popen(f'echo 分支绑定... && {git_path} branch --set-upstream-to={remote_name} {local_name} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,
-                                **sys_seeting)
+    def Bind_remote(self, local_name, remote_name):
+        return subprocess.Popen(
+            f'echo 分支绑定... && {git_path} branch --set-upstream-to={remote_name} {local_name} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def push_Tag(self,tag,remote_name):
-        return subprocess.Popen(f'echo 推送标签... && {git_path} push {remote_name} {tag} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+    def push_Tag(self, tag, remote_name):
+        return subprocess.Popen(
+            f'echo 推送标签... && {git_path} push {remote_name} {tag} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def del_tag(self,tag):
-        return subprocess.Popen(f'echo 删除本地标签... && {git_path} tag -d {tag} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+    def del_tag(self, tag):
+        return subprocess.Popen(
+            f'echo 删除本地标签... && {git_path} tag -d {tag} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Add_Tag(self,tag,commit,message=''):
+    def Add_Tag(self, tag, commit, message=''):
         a = ' -a'
         if message != '':
-            message = f' -m "{message}"'#自带空格
+            message = f' -m "{message}"'  # 自带空格
         else:
             a = ''
         if commit != '':
-            commit = f' {commit}'#自带空格
-        return subprocess.Popen(f'echo 添加标签... && {git_path} tag{a} {tag}{commit}{message} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,
-                                **sys_seeting)
+            commit = f' {commit}'  # 自带空格
+        return subprocess.Popen(
+            f'echo 添加标签... && {git_path} tag{a} {tag}{commit}{message} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Tag(self,condition=''):
+    def Tag(self, condition=''):
         if condition != '':
             condition = f' -l {condition}'
-        return subprocess.Popen(f'echo 标签列表: && {git_path} tag{condition} && echo {self.make_stopKey()}', cwd=self.Repo_Dic,**sys_seeting)
-
-    def show_new(self,condition):
-        return subprocess.Popen(f'echo 查询结果: && {git_path} show {condition} && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+        return subprocess.Popen(
+            f'echo 标签列表: && {git_path} tag{condition} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Pull_Push_remote(self,Pull_Push=0,remote='',remote_branch='',local='',allow=False,u=False,f=False):
-        #处理逻辑
+    def show_new(self, condition):
+        return subprocess.Popen(
+            f'echo 查询结果: && {git_path} show {condition} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
+
+    def Pull_Push_remote(
+        self,
+        Pull_Push=0,
+        remote='',
+        remote_branch='',
+        local='',
+        allow=False,
+        u=False,
+            f=False):
+        # 处理逻辑
         # 1)remote去斜杠第一个作为主机名字
         # 2) 从remote分离主机名(如果没指定)
         # 3) 如果local为空,用HEAD填充
@@ -188,50 +300,67 @@ class git_Repo:#git的基类
 
         split = remote.split('/')
         try:
-            remote_name = split[0]#获取主机名 1)
-        except:
-            remote_name = ''#没有主机名 1)
+            remote_name = split[0]  # 获取主机名 1)
+        except BaseException:
+            remote_name = ''  # 没有主机名 1)
 
         branch_split = remote_branch.split('/')
         if len(branch_split) >= 2 and remote_name == '':
-            remote_name = branch_split[0]# 2)
-            remote_branch = '/'.join(branch_split[1:])# 2)
-        if local.replace(' ','') == '':local = 'HEAD'# 3)
-        if remote_name == '':# 4)
+            remote_name = branch_split[0]  # 2)
+            remote_branch = '/'.join(branch_split[1:])  # 2)
+        if local.replace(' ', '') == '':
+            local = 'HEAD'  # 3)
+        if remote_name == '':  # 4)
             branch = ''
         else:
             if Pull_Push == 1:
                 # 注意,local不可以为空,也不会为空
-                if remote_branch != '':branch = f'{local}:{remote_branch}'# git push <远程主机名> <本地分支名>:<远程分支名>
-                else:branch = f'{local}'#要去掉冒号
+                if remote_branch != '':
+                    # git push <远程主机名> <本地分支名>:<远程分支名>
+                    branch = f'{local}:{remote_branch}'
+                else:
+                    branch = f'{local}'  # 要去掉冒号
             else:
-                if remote_branch != 'HEAD':branch = f'{remote_branch}:{local}'  # git push <远程主机名> <本地分支名>:<远程分支名>
-                else:branch = f'{remote_branch}'
+                if remote_branch != 'HEAD':
+                    # git push <远程主机名> <本地分支名>:<远程分支名>
+                    branch = f'{remote_branch}:{local}'
+                else:
+                    branch = f'{remote_branch}'
 
         if allow:
             history = ' --allow-unrelated-histories'
         else:
             history = ''
-        push_pull = {0:"pull",1:f"push{' -u' if u else ''}{' -f' if f else ''}"}
-        return subprocess.Popen(f'''echo 与服务器连接... && {git_path} {push_pull.get(Pull_Push,"pull")}{history} {remote_name} {branch} && echo {self.make_stopKey()}''',
-                                cwd=self.Repo_Dic, **sys_seeting)
+        push_pull = {
+            0: "pull",
+            1: f"push{' -u' if u else ''}{' -f' if f else ''}"}
+        return subprocess.Popen(
+            f'''echo 与服务器连接... && {git_path} {push_pull.get(Pull_Push,"pull")}{history} {remote_name} {branch} && echo {self.make_stopKey()}''',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def del_Branch_remote(self,remote,remote_branch):
+    def del_Branch_remote(self, remote, remote_branch):
         split = remote.split('/')
         try:
             remote_name = split[0]  # 获取主机名 1)
-        except:
+        except BaseException:
             remote_name = ''  # 没有主机名 1)
         branch_split = remote_branch.split('/')
         if len(branch_split) >= 2 and remote_name == '':
             remote_name = branch_split[0]  # 2)
             remote_branch = '/'.join(branch_split[1:])  # 2)
-        return subprocess.Popen(f'echo 删除远程分支... && {git_path} push {remote_name} :{remote_branch} && echo {self.make_stopKey()}',cwd=self.Repo_Dic, **sys_seeting)
+        return subprocess.Popen(
+            f'echo 删除远程分支... && {git_path} push {remote_name} :{remote_branch} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def del_Tag_remote(self,remote,tag):
-        return subprocess.Popen(f'echo 删除远程标签... && {git_path} push {remote} :refs/tags/{tag} && echo {self.make_stopKey()}',cwd=self.Repo_Dic, **sys_seeting)
+    def del_Tag_remote(self, remote, tag):
+        return subprocess.Popen(
+            f'echo 删除远程标签... && {git_path} push {remote} :refs/tags/{tag} && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def fetch(self,remote,remote_branch,local):
+    def fetch(self, remote, remote_branch, local):
         # 处理逻辑
         # 1)remote去斜杠第一个作为主机名字
         # 2) 从remote分离主机名(如果没指定)
@@ -241,212 +370,247 @@ class git_Repo:#git的基类
         split = remote.split('/')
         try:
             remote_name = split[0]  # 获取主机名 1)
-        except:
+        except BaseException:
             remote_name = ''  # 没有主机名 1)
 
         branch_split = remote_branch.split('/')
         if len(branch_split) >= 2 and remote_name == '':
             remote_name = branch_split[0]  # 2)
             remote_branch = '/'.join(branch_split[1:])  # 2)
-        if local.replace(' ', '') == '': local = 'HEAD'  # 3)
+        if local.replace(' ', '') == '':
+            local = 'HEAD'  # 3)
         if remote_name == '':  # 4)
             branch = ''
         else:
             if remote_branch != 'HEAD':
-                branch = f'{remote_branch}:{local}'  # git push <远程主机名> <本地分支名>:<远程分支名>
+                # git push <远程主机名> <本地分支名>:<远程分支名>
+                branch = f'{remote_branch}:{local}'
             else:
                 branch = f'{remote_branch}'
 
-        return subprocess.Popen(f'''echo 更新远程仓库... && {git_path} fetch {remote_name} {branch} && echo {self.make_stopKey()}''', cwd=self.Repo_Dic, **sys_seeting)
+        return subprocess.Popen(
+            f'''echo 更新远程仓库... && {git_path} fetch {remote_name} {branch} && echo {self.make_stopKey()}''',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def Customize(self,command:str):
-        return subprocess.Popen(command,cwd=self.Repo_Dic, **sys_seeting)
+    def Customize(self, command: str):
+        return subprocess.Popen(command, cwd=self.Repo_Dic, **sys_seeting)
 
-    def Clone(self,url):
-        return subprocess.Popen(f'echo 克隆操作不被允许 && echo {self.make_stopKey()}', cwd=self.Repo_Dic, **sys_seeting)
+    def Clone(self, url):
+        return subprocess.Popen(
+            f'echo 克隆操作不被允许 && echo {self.make_stopKey()}',
+            cwd=self.Repo_Dic,
+            **sys_seeting)
 
-    def make_Dir(self,dir):
-        if len(dir) == '':return dir
+    def make_Dir(self, dir):
+        if len(dir) == '':
+            return dir
         inside = '/'
         if dir[0] == '/':
             inside = ''
         return self.Repo_Dic + inside + dir
 
-    def reset_File(self,hard,file_list):#注意版本回退是:Reset_File
+    def reset_File(self, hard, file_list):  # 注意版本回退是:Reset_File
         file = self.Flie_List(file_list)
         return subprocess.Popen(
             f'''echo 回退文件... && {git_path} reset {hard} {file} && echo {self.make_stopKey()}''',
             cwd=self.Repo_Dic, **sys_seeting)
 
-    def Branch_new(self,old_name,new_name):
+    def Branch_new(self, old_name, new_name):
         return subprocess.Popen(
             f'''echo 回退文件... && {git_path} branch -m {old_name} {new_name} && echo {self.make_stopKey()}''',
             cwd=self.Repo_Dic, **sys_seeting)
 
-class Clone_git(git_Repo):#Clone一个git
+
+class Clone_git(git_Repo):  # Clone一个git
     def __init__(self, Dic, *args, **kwargs):
         self.Repo_Dic = Dic  # 仓库地址
         self.url = None
         self.name = split(Dic)[-1]
         self.have_clone = False
 
-    def Clone(self,url):
-        if self.have_clone:super(Clone_git, self).Clone(url)
+    def Clone(self, url):
+        if self.have_clone:
+            super(Clone_git, self).Clone(url)
         self.have_clone = True
-        return subprocess.Popen(f'echo 正在克隆... && {git_path} clone {url} {self.Repo_Dic}', cwd=split(self.Repo_Dic)[0], **sys_seeting)
+        return subprocess.Popen(
+            f'echo 正在克隆... && {git_path} clone {url} {self.Repo_Dic}',
+            cwd=split(
+                self.Repo_Dic)[0],
+            **sys_seeting)
 
     def after_Clone(self):
         self.repo = Repo(self.Repo_Dic)
 
+
 class git_Ctrol:
     def __init__(self):
-        self.git_Dic = {}#名字-文件位置
-        self.gitType_Dic = {}#名字-类型
+        self.git_Dic = {}  # 名字-文件位置
+        self.gitType_Dic = {}  # 名字-类型
 
-    def Add_init(self,Dic,**kwargs):
+    def Add_init(self, Dic, **kwargs):
         git = git_Repo(Dic)
         self.git_Dic[git.name] = git
         self.gitType_Dic[git.name] = 'init'
         return git.name
 
-    def Clone_init(self,Dic,**kwargs):
+    def Clone_init(self, Dic, **kwargs):
         git = Clone_git(Dic)
         self.git_Dic[git.name] = git
         self.gitType_Dic[git.name] = 'clone'
         return git.name
 
-    def get_git(self,name):
+    def get_git(self, name):
         return self.git_Dic[name]
 
     def get_git_Dic(self):
         return self.git_Dic.copy()
 
-    def get_Dir(self,name):
+    def get_Dir(self, name):
         return self.get_git(name).dir_list()
 
-    def add_File(self,name,dic_list):
+    def add_File(self, name, dic_list):
         return self.get_git(name).Add_File(dic_list)
 
-    def reset_File(self,name,dic_list):
-        return self.get_git(name).Reset_File(dic_list)#移除出去暂存区
+    def reset_File(self, name, dic_list):
+        return self.get_git(name).Reset_File(dic_list)  # 移除出去暂存区
 
-    def commit_File(self,name,m):
+    def commit_File(self, name, m):
         return self.get_git(name).Commit_File(m)
 
-    def log(self,name,graph,pretty,abbrev):
-        return self.get_git(name).Log(graph,pretty,abbrev)
+    def log(self, name, graph, pretty, abbrev):
+        return self.get_git(name).Log(graph, pretty, abbrev)
 
-    def reflog(self,name):
+    def reflog(self, name):
         return self.get_git(name).refLog()
 
-    def status(self,name):
+    def status(self, name):
         return self.get_git(name).Status()
 
-    def diff_File(self,name,MASTER):
+    def diff_File(self, name, MASTER):
         return self.get_git(name).diff(MASTER)
 
-    def back_version(self,name,HEAD,Type=0):
-        return self.get_git(name).reset(HEAD,Type)#版本回退HEAD
+    def back_version(self, name, HEAD, Type=0):
+        return self.get_git(name).reset(HEAD, Type)  # 版本回退HEAD
 
-    def back_version_file(self,name,HEAD,File_list):
-        return self.get_git(name).reset_File(HEAD, File_list)#文件回退
+    def back_version_file(self, name, HEAD, File_list):
+        return self.get_git(name).reset_File(HEAD, File_list)  # 文件回退
 
-    def checkout_version(self,name,file):
-        return self.get_git(name).checkout(file)#弹出
+    def checkout_version(self, name, file):
+        return self.get_git(name).checkout(file)  # 弹出
 
-    def rm(self,name,file):
+    def rm(self, name, file):
         return self.get_git(name).rm(file)
 
-    def check_Branch(self,name):
+    def check_Branch(self, name):
         return self.get_git(name).check_Branch()
 
-    def new_Branch(self,name, new_branch, origin):
+    def new_Branch(self, name, new_branch, origin):
         return self.get_git(name).new_Branch(new_branch, origin)
 
-    def switch_Branch(self,name,branch_name):
+    def switch_Branch(self, name, branch_name):
         return self.get_git(name).switch_Branch(branch_name)
 
-    def Del_Branch(self,name,branch_name,type_):
-        d = {1:'d',0:'D'}.get(type_,'d')
-        return self.get_git(name).del_Branch(branch_name,d)
+    def Del_Branch(self, name, branch_name, type_):
+        d = {1: 'd', 0: 'D'}.get(type_, 'd')
+        return self.get_git(name).del_Branch(branch_name, d)
 
-    def merge_Branch(self,name,branch_name,no_ff,m):
-        return self.get_git(name).merge_Branch(branch_name,no_ff,m)
+    def merge_Branch(self, name, branch_name, no_ff, m):
+        return self.get_git(name).merge_Branch(branch_name, no_ff, m)
 
-    def merge_abort(self,name):
+    def merge_abort(self, name):
         return self.get_git(name).merge_abort()
 
-    def Save_stash(self,name):
+    def Save_stash(self, name):
         return self.get_git(name).Save_stash()
 
-    def Stash_List(self,name):
+    def Stash_List(self, name):
         return self.get_git(name).Stash_List()
 
-    def Apply_stash(self,name,stash_num='0'):
+    def Apply_stash(self, name, stash_num='0'):
         return self.get_git(name).Apply_stash(stash_num)
 
-    def Drop_stash(self,name,stash_num='0'):
+    def Drop_stash(self, name, stash_num='0'):
         return self.get_git(name).Drop_stash(stash_num)
 
-    def cherry_pick(self,name,commit):
+    def cherry_pick(self, name, commit):
         return self.get_git(name).cherry_pick(commit)
 
-    def Del_remote(self,name,remote_name):
+    def Del_remote(self, name, remote_name):
         return self.get_git(name).Del_remote(remote_name)
 
-    def Add_remote(self,name,remote,remote_name):
-        return self.get_git(name).Add_remote(remote,remote_name)
-
-    def Bind_remote(self,name,local_name,remote_name):
-        return self.get_git(name).Bind_remote(local_name,remote_name)
-
-    def Pull_remote(self,name,local_name,remote_name,remote_branch,allow=False,u=False,f=False):
-        return self.get_git(name).Pull_Push_remote(0,remote_name,remote_branch,local_name,allow,u,False)
-
-    def Push_remote(self,name,local_name,remote_name,remote_branch,allow=False,u=False,f=False):
-        return self.get_git(name).Pull_Push_remote(1,remote_name,remote_branch,local_name,False,u,f)#push没有allow选项
-
-    def Tag(self,name, condition=''):
+    def Add_remote(self, name, remote, remote_name):
+        return self.get_git(name).Add_remote(remote, remote_name)
+
+    def Bind_remote(self, name, local_name, remote_name):
+        return self.get_git(name).Bind_remote(local_name, remote_name)
+
+    def Pull_remote(
+        self,
+        name,
+        local_name,
+        remote_name,
+        remote_branch,
+        allow=False,
+        u=False,
+            f=False):
+        return self.get_git(name).Pull_Push_remote(
+            0, remote_name, remote_branch, local_name, allow, u, False)
+
+    def Push_remote(
+        self,
+        name,
+        local_name,
+        remote_name,
+        remote_branch,
+        allow=False,
+        u=False,
+            f=False):
+        return self.get_git(name).Pull_Push_remote(
+            1, remote_name, remote_branch, local_name, False, u, f)  # push没有allow选项
+
+    def Tag(self, name, condition=''):
         return self.get_git(name).Tag(condition)  # push没有allow选项
 
-    def show_new(self,name, condition):
+    def show_new(self, name, condition):
         return self.get_git(name).show_new(condition)  # push没有allow选项
 
-    def Add_Tag(self,name,tag,commit,message=''):
-        return self.get_git(name).Add_Tag(tag,commit,message)  # push没有allow选项
+    def Add_Tag(self, name, tag, commit, message=''):
+        return self.get_git(name).Add_Tag(
+            tag, commit, message)  # push没有allow选项
 
-    def push_Tag(self,name, tag, remoto):
+    def push_Tag(self, name, tag, remoto):
         return self.get_git(name).push_Tag(tag, remoto)
 
-    def push_allTag(self,name, remoto):
+    def push_allTag(self, name, remoto):
         return self.get_git(name).push_Tag('--tags', remoto)
 
-    def del_Tag_remote(self,name , remote, tag):
+    def del_Tag_remote(self, name, remote, tag):
         return self.get_git(name).del_Tag_remote(remote, tag)
 
-    def del_Branch_remote(self,name , remote, remote_Branch):
+    def del_Branch_remote(self, name, remote, remote_Branch):
         return self.get_git(name).del_Branch_remote(remote, remote_Branch)
 
-    def del_tag(self,name,tag):
+    def del_tag(self, name, tag):
         return self.get_git(name).del_tag(tag)
 
-    def Fetch(self,name,local_name,remote_name,remote_branch):
-        return self.get_git(name).fetch(remote_name,remote_branch,local_name)
+    def Fetch(self, name, local_name, remote_name, remote_branch):
+        return self.get_git(name).fetch(remote_name, remote_branch, local_name)
 
-    def Customize(self,name,command:str):
+    def Customize(self, name, command: str):
         return self.get_git(name).Customize(command)
 
-    def Clone(self,name,url):
+    def Clone(self, name, url):
         return self.get_git(name).Clone(url)
 
-    def After_Clone(self,name):
+    def After_Clone(self, name):
         try:
             return self.get_git(name).after_Clone()
-        except:
+        except BaseException:
             return None
 
-    def make_Dir(self,name,dir):
+    def make_Dir(self, name, dir):
         return self.get_git(name).make_Dir(dir)
 
-    def Branch_new(self,name, old_name, new_name):
-        return self.get_git(name).Branch_new(old_name,new_name)
+    def Branch_new(self, name, old_name, new_name):
+        return self.get_git(name).Branch_new(old_name, new_name)

+ 637 - 238
HSCH/Func_Matlib.py

@@ -1,68 +1,83 @@
-import numpy,pandas
+import numpy
+import pandas
 from matplotlib import pyplot as plt
 from matplotlib import rcParams
-import tkinter,tkinter.messagebox
+import tkinter
+import tkinter.messagebox
 import math
 import random
 from tkinter.filedialog import asksaveasfile
 import tkinter.messagebox
 from os import path
-from HSCH.HS import HS_lambda,HS_CSV
+from HSCH.HS import HS_lambda, HS_CSV
 from HSCH.Func_advanced import Advanced_Control
 
-def Float(IN,si = float,n = True):#Float筛选系统
+
+def Float(IN, si=float, n=True):  # Float筛选系统
     x = []
     for i in IN:
         try:
-            if si(i) == si(0) and n: continue
+            if si(i) == si(0) and n:
+                continue
             x.append(si(i))
         except ValueError:
             pass
     return x
 
+
 def Fucn_Draw():
-    global HS,X_Input,fig,Xlim_Input,Ylim_Input,YK_Input,XK_Input
-    #画板创造
+    global HS, X_Input, fig, Xlim_Input, Ylim_Input, YK_Input, XK_Input
+    # 画板创造
     addNews('生成绘制取...')
     fig = plt.figure(num='CoTan函数')  # 定义一个图像窗口
-    plt.grid(True,ls='--')  # 显示网格(不能放到后面,因为后面调整成为了笛卡尔坐标系)
+    plt.grid(True, ls='--')  # 显示网格(不能放到后面,因为后面调整成为了笛卡尔坐标系)
     ax = plt.gca()
     ax.spines['right'].set_color('none')
     ax.spines['top'].set_color('none')
     ax.xaxis.set_ticks_position('bottom')
     ax.yaxis.set_ticks_position('left')
-    ax.spines['bottom'].set_position(('data', 0))# 设置x轴, y轴在(0, 0)的位置
+    ax.spines['bottom'].set_position(('data', 0))  # 设置x轴, y轴在(0, 0)的位置
     ax.spines['left'].set_position(('data', 0))
-    #检测x
+    # 检测x
     try:
-        if XK_Input.get()[0] == 'c':#如果输入函数cx#-10#10#1#1
-            _HS = XK_Input.get()[1:].split('#')#第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
-            P = ['x',-10,10,1,2]#保护系统
+        if XK_Input.get()[0] == 'c':  # 如果输入函数cx#-10#10#1#1
+            # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
+            _HS = XK_Input.get()[1:].split('#')
+            P = ['x', -10, 10, 1, 2]  # 保护系统
             try:
                 P[0] = _HS[0]
                 P[1] = int(_HS[1])
                 P[2] = int(_HS[2])
                 P[3] = int(_HS[3])
                 P[4] = int(_HS[4])
-            except:#迭代匹配直到出现错误
+            except BaseException:  # 迭代匹配直到出现错误
                 pass
             _HS = P
-            x = Float(HS_lambda(_HS[0],'x','',_HS[1],_HS[2],_HS[3],_HS[4]).Cul()[1])#取y
+            x = Float(
+                HS_lambda(
+                    _HS[0],
+                    'x',
+                    '',
+                    _HS[1],
+                    _HS[2],
+                    _HS[3],
+                    _HS[4]).Cul()[1])  # 取y
             ax.set_xticks(x)
-        elif XK_Input.get()[0] == 'y':#输入函数y
+        elif XK_Input.get()[0] == 'y':  # 输入函数y
             x = abs(int(XK_Input.get()[1:]))
-            x_major_locator=plt.MultipleLocator(x)
+            x_major_locator = plt.MultipleLocator(x)
             ax.xaxis.set_major_locator(x_major_locator)
-        else:#输入纯数字
+        else:  # 输入纯数字
             x = Float(XK_Input.get().split(','))
             ax.set_xticks(x)
-    except:
+    except BaseException:
         x_major_locator = plt.MultipleLocator(2)
         ax.xaxis.set_major_locator(x_major_locator)
-    #检测y
-    try:#意外捕捉
+    # 检测y
+    try:  # 意外捕捉
         if YK_Input.get()[0] == 'c':  # 如果输入函数cx#-10#10#1#1
-            _HS = YK_Input.get()[1:].split('#')  # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
+            # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
+            _HS = YK_Input.get()[1:].split('#')
             P = ['x', -10, 10, 1, 2]  # 保护系统
             try:
                 P[0] = _HS[0]
@@ -70,10 +85,18 @@ def Fucn_Draw():
                 P[2] = int(_HS[2])
                 P[3] = int(_HS[3])
                 P[4] = int(_HS[4])
-            except:  # 迭代匹配直到出现错误
+            except BaseException:  # 迭代匹配直到出现错误
                 pass
             _HS = P
-            y = Float(HS_lambda(_HS[0], 'y', '', _HS[1], _HS[2], _HS[3], _HS[4]).Cul()[1])  # 取y
+            y = Float(
+                HS_lambda(
+                    _HS[0],
+                    'y',
+                    '',
+                    _HS[1],
+                    _HS[2],
+                    _HS[3],
+                    _HS[4]).Cul()[1])  # 取y
             ax.set_yticks(y)
         elif YK_Input.get()[0] == 'y':  # 输入函数y
             y = abs(int(YK_Input.get()[1:]))
@@ -82,27 +105,32 @@ def Fucn_Draw():
         else:
             y = Float(YK_Input.get().split(','))
             ax.set_yticks(y)
-    except:
+    except BaseException:
         y_major_locator = plt.MultipleLocator(2)
         ax.yaxis.set_major_locator(y_major_locator)
-    #极限设计
+    # 极限设计
     try:
-        xlim_IN = Float(Xlim_Input.get().split(','),si=int,n=False)
-        ylim_IN = Float(Ylim_Input.get().split(','),si=int,n=False)
-        try:_xlim = [xlim_IN[0], xlim_IN[1]]
-        except:_xlim = [-10,10]
-        try:_ylim = [ylim_IN[0], ylim_IN[1]]
-        except:_ylim = _xlim
-    except:
+        xlim_IN = Float(Xlim_Input.get().split(','), si=int, n=False)
+        ylim_IN = Float(Ylim_Input.get().split(','), si=int, n=False)
+        try:
+            _xlim = [xlim_IN[0], xlim_IN[1]]
+        except BaseException:
+            _xlim = [-10, 10]
+        try:
+            _ylim = [ylim_IN[0], ylim_IN[1]]
+        except BaseException:
+            _ylim = _xlim
+    except BaseException:
         _xlim = [-10, 10]
-        _ylim = [-10,10]
+        _ylim = [-10, 10]
     _xlim.sort()
     _ylim.sort()
     plt.xlim(_xlim)
     plt.ylim(_ylim)
-    #函数绘图系统
+    # 函数绘图系统
     addNews('图像绘制中...')
-    if not HS:return False
+    if not HS:
+        return False
     for Fucn in HS:
         get = Fucn.Draw_Cul()
         fx = get[0]
@@ -114,62 +142,84 @@ def Fucn_Draw():
             x = fx[i]
             y = fy[i]
             if First:
-                plt.plot(x, y,View,label = Func_label)  # plot()画出曲线
+                plt.plot(x, y, View, label=Func_label)  # plot()画出曲线
                 First = False
             else:
                 plt.plot(x, y, View)
         get = Fucn.getMemory()
         m_x = get[0]
         m_y = get[1]
-        max_x,max_y,min_x,min_y = Fucn.Best_value()
-        plt.plot(m_x, m_y, View[0]+'o',label=f'Point of {Func_label}')  # 画出一些点
-        len_x = sorted(list(set(m_x)))#去除list重复项目
+        max_x, max_y, min_x, min_y = Fucn.Best_value()
+        plt.plot(
+            m_x,
+            m_y,
+            View[0] + 'o',
+            label=f'Point of {Func_label}')  # 画出一些点
+        len_x = sorted(list(set(m_x)))  # 去除list重复项目
         JZD = max_x + min_x
 
         o_x = None
         for i in range(len(len_x)):
-            if i in JZD:continue#去除极值点
-            _x = len_x[i]#x
-            if o_x == None or abs(_x - o_x) >= 1:#确保位置
-                num = m_x.index(_x)#y的座位
+            if i in JZD:
+                continue  # 去除极值点
+            _x = len_x[i]  # x
+            if o_x is None or abs(_x - o_x) >= 1:  # 确保位置
+                num = m_x.index(_x)  # y的座位
                 _y = m_y[num]
-                plt.text(_x,_y,f'({_x},{int(_y)})', fontdict={'size': '10', 'color':'b'})# 标出坐标
+                plt.text(
+                    _x, _y, f'({_x},{int(_y)})', fontdict={
+                        'size': '10', 'color': 'b'})  # 标出坐标
                 o_x = _x
 
         o_x = None
         n_max = []
-        for i in range(len(max_x)):#画出最大值
+        for i in range(len(max_x)):  # 画出最大值
             _x = max_x[i]
-            if o_x == None or abs(_x - o_x) >= 1:  # 确保位置
-                plt.text(_x-1, max_y, f'max:({_x},{int(max_y)})', fontdict={'size': '10', 'color': 'b'})  # 标出坐标
+            if o_x is None or abs(_x - o_x) >= 1:  # 确保位置
+                plt.text(
+                    _x - 1,
+                    max_y,
+                    f'max:({_x},{int(max_y)})',
+                    fontdict={
+                        'size': '10',
+                        'color': 'b'})  # 标出坐标
                 n_max.append(_x)
                 o_x = _x
 
         o_x = None
         n_min = []
-        for i in range(len(min_x)):#画出最小值
+        for i in range(len(min_x)):  # 画出最小值
             _x = min_x[i]
-            if o_x == None or abs(_x - o_x) >= 1:
+            if o_x is None or abs(_x - o_x) >= 1:
                 n_min.append(_x)
-                plt.text(_x-1, min_y, f'min:({_x},{int(min_y)})', fontdict={'size': '10', 'color': 'b'})  # 标出坐标
+                plt.text(
+                    _x - 1,
+                    min_y,
+                    f'min:({_x},{int(min_y)})',
+                    fontdict={
+                        'size': '10',
+                        'color': 'b'})  # 标出坐标
                 o_x = _x
         plt.plot(n_min, [min_y] * len(n_min), View[0] + 'o')  # 画出一些点
         plt.plot(n_max, [max_y] * len(n_max), View[0] + 'o')  # 画出一些点
     addNews('绘制完毕')
-    plt.legend()#显示图示
+    plt.legend()  # 显示图示
     plt.show()  # 显示图像
     return True
 
-def Fucn_Cul_CSV():#添加函数
 
-    global HS,HS_str,lb,x_I,Name_Input,View_C,View_Co,View_Input
-    File = tkinter.filedialog.askopenfilename(title='载入表格',filetypes=[("CSV", ".csv")])
+def Fucn_Cul_CSV():  # 添加函数
+
+    global HS, HS_str, lb, x_I, Name_Input, View_C, View_Co, View_Input
+    File = tkinter.filedialog.askopenfilename(
+        title='载入表格', filetypes=[("CSV", ".csv")])
     view = View_Input.get().split('#')
     try:
-        if view[0] not in View_Co:view[0] = 'b'
+        if view[0] not in View_Co:
+            view[0] = 'b'
         v_2 = View_C.get(view[1], '-')
-    except:
-        view = ['','']
+    except BaseException:
+        view = ['', '']
         view[0] = random.choice(View_Co)
         v_2 = '-'
     V = view[0] + v_2
@@ -177,49 +227,63 @@ def Fucn_Cul_CSV():#添加函数
         addNews('读取CSV')
         read = pandas.read_csv(File)
         name = path.basename(File)[0:-4].replace(' ', '')
-        if not name:name = random.randint(1,1000)
+        if not name:
+            name = random.randint(1, 1000)
         name += '(In CSV)'
         _HS = numpy.array(read).tolist()
         if len(_HS[0]) != len(_HS[1]):
             raise Exception
         HS_str.append(name)
-        HS.append(HS_CSV(_HS,name,V))
+        HS.append(HS_CSV(_HS, name, V))
         lb.delete(0, tkinter.END)
         lb.insert(tkinter.END, *HS)
         addNews('读取完毕')
-    except:
+    except BaseException:
         addNews('读取失败')
 
-def Fucn_Cul():#添加函数
-    global HS,HS_str,lb,x_I,Name_Input,View_C,View_Co,View_Input
+
+def Fucn_Cul():  # 添加函数
+    global HS, HS_str, lb, x_I, Name_Input, View_C, View_Co, View_Input
     get = Func_Input.get().replace(' ', '')
     x_I = X_Input.get().split(',')
     name = Name_Input.get().replace(' ', '')
     view = View_Input.get().split('#')
-    if not name:name = get
+    if not name:
+        name = get
     try:
-        if view[0] not in View_Co:view[0] = 'b'
+        if view[0] not in View_Co:
+            view[0] = 'b'
         v_2 = View_C.get(view[1], '-')
-    except:
-        view = ['','']
+    except BaseException:
+        view = ['', '']
         view[0] = random.choice(View_Co)
         v_2 = '-'
     V = view[0] + v_2
     try:
         c = x_I[2]
         if c[0] == 'H':
-            Name = {'Pi': math.pi, 'e': math.e, 'log': math.log,
-                    'sin': math.sin, 'cos': math.cos, 'tan': math.tan,
-                    'cot': lambda x: 1 / math.tan(x), 'csc': lambda x: 1 / math.sin(x),
-                    'sec': lambda x: 1 / math.cos(x), 'sinh': math.sinh, 'cosh': math.cosh,
-                    'tanh': math.tanh, 'asin': math.asin, 'acos': math.acos,
-                    'atan': math.atan}
-            x_I[2] = eval(c[1:],Name)
-    except:
+            Name = {
+                'Pi': math.pi,
+                'e': math.e,
+                'log': math.log,
+                'sin': math.sin,
+                'cos': math.cos,
+                'tan': math.tan,
+                'cot': lambda x: 1 / math.tan(x),
+                'csc': lambda x: 1 / math.sin(x),
+                'sec': lambda x: 1 / math.cos(x),
+                'sinh': math.sinh,
+                'cosh': math.cosh,
+                'tanh': math.tanh,
+                'asin': math.asin,
+                'acos': math.acos,
+                'atan': math.atan}
+            x_I[2] = eval(c[1:], Name)
+    except BaseException:
         pass
     if get and get not in HS_str:
         HS_str.append(get)
-        HS.append(HS_lambda(get,name,V,*x_I))
+        HS.append(HS_lambda(get, name, V, *x_I))
         lb.delete(0, tkinter.END)
         lb.insert(tkinter.END, *HS)
         addNews('函数生成完毕')
@@ -227,65 +291,71 @@ def Fucn_Cul():#添加函数
         addNews('函数生成失败')
         pass
 
-def Fucn_Cul_Clear():#添加函数
-    global HS,HS_str,lb,x_I,Name_Input,View_C,View_Co,View_Input
+
+def Fucn_Cul_Clear():  # 添加函数
+    global HS, HS_str, lb, x_I, Name_Input, View_C, View_Co, View_Input
     if tkinter.messagebox.askokcancel('提示', '是否清空所有函数?)'):
         HS_str = []
         HS = []
         lb.delete(0, tkinter.END)
         addNews('函数清空完毕')
 
-def Fucn_Numpy():#显示xy
-    global HS,lb,Pr_BOX
+
+def Fucn_Numpy():  # 显示xy
+    global HS, lb, Pr_BOX
     try:
         Fucn = HS[lb.curselection()[0]]
         Pr_BOX.delete(0, tkinter.END)
-        Pr_BOX.insert(tkinter.END,*Fucn.returnList())
+        Pr_BOX.insert(tkinter.END, *Fucn.returnList())
         addNews('表格创建成功')
-    except:
+    except BaseException:
         addNews('无法创建表格')
         pass
 
+
 def Cul_Y_Clear():
-    global Xcul_Input,lb,HS
+    global Xcul_Input, lb, HS
     try:
-        if tkinter.messagebox.askokcancel('提示', f'确定删除{HS[lb.curselection()[0]]}的记忆吗?'):
+        if tkinter.messagebox.askokcancel(
+                '提示', f'确定删除{HS[lb.curselection()[0]]}的记忆吗?'):
             Y_cul.delete(0, tkinter.END)
             Fucn = HS[lb.curselection()[0]]
             Fucn.Clear_Memory()
             addNews('删除完毕')
         else:
             addNews('删除取消')
-    except:
+    except BaseException:
         addNews('删除失败')
 
-def Cul_Y_YC():#显示xy
-    global HS,Y_cul
+
+def Cul_Y_YC():  # 显示xy
+    global HS, Y_cul
     try:
         Fucn = HS[lb.curselection()[0]]
         Y_cul.delete(0, tkinter.END)
         Fucn.YC_On_Off()
         addNews('已清空卡槽')
-    except:
+    except BaseException:
         addNews('隐藏(显示)失败')
 
 
-def Cul_Y_Check():#显示xy
-    global HS,Y_cul
+def Cul_Y_Check():  # 显示xy
+    global HS, Y_cul
     try:
         Fucn = HS[lb.curselection()[0]]
         Y_cul.delete(0, tkinter.END)
-        m_x,m_y = Fucn.getMemory()
+        m_x, m_y = Fucn.getMemory()
         answer = []
         for i in range(len(m_x)):
             answer.append(f'x={m_x[i]} -> y={m_y[i]}')
         Y_cul.insert(tkinter.END, *answer)
         addNews('输出完成')
-    except:
+    except BaseException:
         addNews('操作失败')
 
+
 def Fucn_XZ():
-    global HS,lb,XZ_box
+    global HS, lb, XZ_box
     try:
         addNews('预测过程程序可能无响应')
         Fucn = HS[lb.curselection()[0]]
@@ -296,8 +366,9 @@ def Fucn_XZ():
     except IndexError:
         addNews('性质预测失败')
 
+
 def Cul_Y():
-    global HS,Y_cul,Xcul_Input,lb
+    global HS, Y_cul, Xcul_Input, lb
     try:
         addNews('计算过程程序可能无响应')
         Fucn = HS[lb.curselection()[0]]
@@ -309,26 +380,30 @@ def Cul_Y():
     except IndexError:
         addNews('计算失败')
 
-def Fucn_Save():#导出CSV
+
+def Fucn_Save():  # 导出CSV
     global CSV
-    if not lb.curselection():return False
+    if not lb.curselection():
+        return False
     try:
         Fucn = HS[lb.curselection()[0]]
         Fucn.Out()
         addNews('CSV导出成功')
-    except:
+    except BaseException:
         addNews('CSV导出失败')
 
-def Fucn_Del():#删除函数
-    global HS,HS_str,lb
+
+def Fucn_Del():  # 删除函数
+    global HS, HS_str, lb
     del_Fucn = lb.curselection()
-    for i in del_Fucn:#只存在一项
+    for i in del_Fucn:  # 只存在一项
         lb.delete(i)
         del HS[i]
         del HS_str[i]
         addNews('函数删除完毕')
 
-def Find(x,y,in_y):
+
+def Find(x, y, in_y):
     m = []
     while True:  # 筛选求出最大值极值点
         try:
@@ -340,231 +415,555 @@ def Find(x,y,in_y):
             break
     return m
 
+
 def Cul_X():
-    global HS,Y_cul,Ycul_Input,E_Input
+    global HS, Y_cul, Ycul_Input, E_Input
     try:
         addNews('计算过程程序可能无响应')
-        Fucn = HS[lb.curselection()[0]]#获取目标函数
-        Y_cul.delete(0, tkinter.END)#清空
-        y = Ycul_Input.get().split(',')#拆解输入
+        Fucn = HS[lb.curselection()[0]]  # 获取目标函数
+        Y_cul.delete(0, tkinter.END)  # 清空
+        y = Ycul_Input.get().split(',')  # 拆解输入
         E = E_Input.get().split('#')  # 拆解输入
         answer = []
         addNews('系统运算中')
         for i in y:
-            answer += Fucn.Cul_dichotomy(float(i),*E)[0]
+            answer += Fucn.Cul_dichotomy(float(i), *E)[0]
         if answer:
             addNews('系统运算完成')
             Y_cul.insert(tkinter.END, *answer)
-        else:addNews('系统运算无结果')
-    except :
+        else:
+            addNews('系统运算无结果')
+    except BaseException:
         addNews('系统运算失败')
         Y_cul.delete(0, tkinter.END)
 
+
 def Cul_X_TD():
-    global HS,Y_cul,YTDcul_Input
+    global HS, Y_cul, YTDcul_Input
     try:
         addNews('计算过程程序可能无响应')
-        Fucn = HS[lb.curselection()[0]]#获取目标函数
-        Y_cul.delete(0, tkinter.END)#清空
-        E = YTDcul_Input.get().split('#')#拆解输入
+        Fucn = HS[lb.curselection()[0]]  # 获取目标函数
+        Y_cul.delete(0, tkinter.END)  # 清空
+        E = YTDcul_Input.get().split('#')  # 拆解输入
         addNews('系统运算中')
         answer = Fucn.Iterative_method_Of_Huan(*E)
         if answer[1]:
             Y_cul.insert(tkinter.END, answer[0])
             addNews('系统运算完成')
-        else:addNews('系统运算无结果')
-    except :
+        else:
+            addNews('系统运算无结果')
+    except BaseException:
         addNews('系统运算失败,请注意参数设置')
         Y_cul.delete(0, tkinter.END)
 
+
 def addNews(News):
-    global News_box,T
+    global News_box, T
     T += 1
     News = str(News)
-    News_box.insert(0, News+f'({T})')
+    News_box.insert(0, News + f'({T})')
     top.update()
 
+
 def Fucn_DHS():
-    global HS, lb, XZ_box,HS_str,x_I,Name_Input,View_C,View_Co,View_Input
+    global HS, lb, XZ_box, HS_str, x_I, Name_Input, View_C, View_Co, View_Input
     try:
         Fucn = HS[lb.curselection()[0]]
         DHS = Fucn.DHS
-        if DHS != None and str(DHS):
+        if DHS is not None and str(DHS):
             get = str(DHS)
             HS_str.append(get)
-            HS.append(HS_lambda(get, '(导)'+Fucn.Func_Name+' Of ', Fucn.View,Fucn.start,Fucn.end,Fucn.kd,Fucn.JD))
+            HS.append(
+                HS_lambda(
+                    get,
+                    '(导)' +
+                    Fucn.Func_Name +
+                    ' Of ',
+                    Fucn.View,
+                    Fucn.start,
+                    Fucn.end,
+                    Fucn.kd,
+                    Fucn.JD))
             lb.delete(0, tkinter.END)
             lb.insert(tkinter.END, *HS)
             addNews('函数生成完毕')
         else:
             raise Exception
-    except:
+    except BaseException:
         addNews('导函数创建失败')
 
+
 def Func_Control():
-    global top,FONT,View_C,View_Co,CSV,Func_Input,X_Input,Name_Input,View_Input,XK_Input,YK_Input,Xlim_Input,Ylim_Input
-    global lb,Pr_BOX,Xcul_Input,Y_cul,HS,HS_str,Ycul_Input,E_Input,YTDcul_Input,XZ_box,News_box,T
+    global top, FONT, View_C, View_Co, CSV, Func_Input, X_Input, Name_Input, View_Input, XK_Input, YK_Input, Xlim_Input, Ylim_Input
+    global lb, Pr_BOX, Xcul_Input, Y_cul, HS, HS_str, Ycul_Input, E_Input, YTDcul_Input, XZ_box, News_box, T
     HS = []
     HS_str = []
     T = 0
 
-    #控制面板使用Tk实现
+    # 控制面板使用Tk实现
     top = tkinter.Tk()  # 设置屏幕
     top.title('CoTan函数测绘')
     top.resizable(width=False, height=False)
     top.geometry(f'+10+10')
-    FONT = ('Font\ZKST.ttf', 11)#设置字体
+    FONT = (r'Font\ZKST.ttf', 11)  # 设置字体
     rcParams['font.family'] = 'simhei'
-    rcParams['axes.unicode_minus']=False
-
-    View_C = {'实线':'-',
-              '短横线':'--',
-              '点划线':'-,',
-              '虚线':':',
-              '点标记':'.',
-              '圆标记':'o',
-              '倒三角':'v',
-              '正三角':'^',
-              '左三角':'&lt',
-              '下箭头':'1',
-              '上箭头':'2',
-              '左箭头':'3',
-              '右箭头':'4',
-              '正方形':'s',
-              '五边形':'p',
-              '星形':'*',
-              '六边形':'h',
-              '六边形2':'H',
-              '+号':'+',
-              'X标记':'x',}#函数样式翻译表
-    View_Co = ['g','r','c','m','y','k']
+    rcParams['axes.unicode_minus'] = False
+
+    View_C = {'实线': '-',
+              '短横线': '--',
+              '点划线': '-,',
+              '虚线': ':',
+              '点标记': '.',
+              '圆标记': 'o',
+              '倒三角': 'v',
+              '正三角': '^',
+              '左三角': '&lt',
+              '下箭头': '1',
+              '上箭头': '2',
+              '左箭头': '3',
+              '右箭头': '4',
+              '正方形': 's',
+              '五边形': 'p',
+              '星形': '*',
+              '六边形': 'h',
+              '六边形2': 'H',
+              '+号': '+',
+              'X标记': 'x', }  # 函数样式翻译表
+    View_Co = ['g', 'r', 'c', 'm', 'y', 'k']
     CSV = []
 
-    width_B = 12#标准宽度
-    height_B=1
-    #column-水平方向,row-竖直方向
-    #设置解析式
-    tkinter.Label(top,text='输入解析式:',font=FONT,width=width_B,height=height_B).grid(column = 0,row = 0)#设置说明
-    Func_Input = tkinter.Entry(top,width=width_B * 2)
-    Func_Input.grid(column = 1,row = 0,columnspan = 2,sticky = tkinter.E+tkinter.W)
-
-    #设置定义域
-    tkinter.Label(top,font=FONT,text='定义域:',width=width_B,height=height_B).grid(column = 0,row = 1)#设置说明
-    X_Input = tkinter.Entry(top,width=width_B * 2)
-    X_Input.grid(column = 1,row = 1,columnspan = 2,sticky = tkinter.E+tkinter.W)
-
-    #设置函数名字
-    tkinter.Label(top,font=FONT,text='函数名字:',width=width_B,height=height_B).grid(column = 0,row = 2)#设置说明
-    Name_Input = tkinter.Entry(top,width=width_B * 2)
-    Name_Input.grid(column = 1,row = 2,columnspan = 2,sticky = tkinter.E+tkinter.W)
-
-    #设置函数图示
-    tkinter.Label(top,font=FONT,text='函数样式:',width=width_B,height=height_B).grid(column = 0,row = 3)#设置说明
-    View_Input = tkinter.Entry(top,width=width_B * 2)
-    View_Input.grid(column = 1,row = 3,columnspan = 2,sticky = tkinter.E+tkinter.W)
-
-    a_y = 4#按钮统一纵坐标
-    tkinter.Button(top,text='添加新函数',command=Fucn_Cul,font=FONT,width=width_B,height=height_B).grid(column = 0,row = a_y)#添加函数
-    tkinter.Button(top,text='删除选中函数',command=Fucn_Del,font=FONT,width=width_B,height=height_B).grid(column = 1,row = a_y)#删除函数
-    tkinter.Button(top,text='清除函数',command=Fucn_Cul_Clear,font=FONT,width=width_B,height=height_B).grid(column = 2,row = a_y)#绘制函数
+    width_B = 12  # 标准宽度
+    height_B = 1
+    # column-水平方向,row-竖直方向
+    # 设置解析式
+    tkinter.Label(
+        top,
+        text='输入解析式:',
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=0,
+        row=0)  # 设置说明
+    Func_Input = tkinter.Entry(top, width=width_B * 2)
+    Func_Input.grid(
+        column=1,
+        row=0,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    # 设置定义域
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='定义域:',
+        width=width_B,
+        height=height_B).grid(
+        column=0,
+        row=1)  # 设置说明
+    X_Input = tkinter.Entry(top, width=width_B * 2)
+    X_Input.grid(column=1, row=1, columnspan=2, sticky=tkinter.E + tkinter.W)
+
+    # 设置函数名字
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='函数名字:',
+        width=width_B,
+        height=height_B).grid(
+        column=0,
+        row=2)  # 设置说明
+    Name_Input = tkinter.Entry(top, width=width_B * 2)
+    Name_Input.grid(
+        column=1,
+        row=2,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    # 设置函数图示
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='函数样式:',
+        width=width_B,
+        height=height_B).grid(
+        column=0,
+        row=3)  # 设置说明
+    View_Input = tkinter.Entry(top, width=width_B * 2)
+    View_Input.grid(
+        column=1,
+        row=3,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    a_y = 4  # 按钮统一纵坐标
+    tkinter.Button(
+        top,
+        text='添加新函数',
+        command=Fucn_Cul,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=0,
+        row=a_y)  # 添加函数
+    tkinter.Button(
+        top,
+        text='删除选中函数',
+        command=Fucn_Del,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=1,
+        row=a_y)  # 删除函数
+    tkinter.Button(
+        top,
+        text='清除函数',
+        command=Fucn_Cul_Clear,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=2,
+        row=a_y)  # 绘制函数
     a_y += 1
-    #显示函数
-    lb=tkinter.Listbox(top,width=width_B*3+2)#暂时不启用多选
+    # 显示函数
+    lb = tkinter.Listbox(top, width=width_B * 3 + 2)  # 暂时不启用多选
     TD_a_y = 10
-    lb.grid(column = 0,row = a_y,columnspan = 3,rowspan = TD_a_y,sticky = tkinter.S+tkinter.N+tkinter.E+tkinter.W)
+    lb.grid(
+        column=0,
+        row=a_y,
+        columnspan=3,
+        rowspan=TD_a_y,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
     a_y += TD_a_y
-    tkinter.Label(top, font=FONT, text='', width=width_B, height=1).grid(column=0, row=a_y)
-
-    tkinter.Label(top, font=FONT, text='', width=1).grid(column=4, row=0)  # 占用第四
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='',
+        width=width_B,
+        height=1).grid(
+        column=0,
+        row=a_y)
+
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='',
+        width=1).grid(
+        column=4,
+        row=0)  # 占用第四
     a_y = 0
-    #输入x函数求y值
-    tkinter.Label(top, font=FONT, text='计算(y):', width=width_B, height=height_B).grid(column=5, row=a_y)  # 设置说明
-    Xcul_Input = tkinter.Entry(top,width=width_B * 2)
-    Xcul_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 输入x函数求y值
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='计算(y):',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    Xcul_Input = tkinter.Entry(top, width=width_B * 2)
+    Xcul_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    #输入x函数求y值
-    tkinter.Label(top, font=FONT, text='二分法计算(y):', width=width_B, height=height_B).grid(column=5, row=a_y)  # 设置说明
-    Ycul_Input = tkinter.Entry(top,width=width_B * 2)
-    Ycul_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 输入x函数求y值
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='二分法计算(y):',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    Ycul_Input = tkinter.Entry(top, width=width_B * 2)
+    Ycul_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, font=FONT, text='二分法参数:', width=width_B, height=height_B).grid(column=5, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='二分法参数:',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
     E_Input = tkinter.Entry(top, width=width_B * 2)
-    E_Input.grid(column=6, row=a_y, columnspan=2,sticky = tkinter.E+tkinter.W)
+    E_Input.grid(column=6, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
 
     a_y += 1
-    #输入x函数求y值
-    tkinter.Label(top, font=FONT, text='梯度法计算(y):', width=width_B, height=height_B).grid(column=5, row=a_y)  # 设置说明
-    YTDcul_Input = tkinter.Entry(top,width=width_B * 2)
-    YTDcul_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 输入x函数求y值
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='梯度法计算(y):',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    YTDcul_Input = tkinter.Entry(top, width=width_B * 2)
+    YTDcul_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top, text='计算(y)', command=Cul_Y, font=FONT, width=width_B, height=height_B).grid(column=5,row=a_y)  # 设置说明
-    tkinter.Button(top, text='二分法计算(x)', command=Cul_X, font=FONT, width=width_B, height=height_B).grid(column=6,row=a_y)
-    tkinter.Button(top, text='梯度法计算(x)', command=Cul_X_TD, font=FONT, width=width_B, height=height_B).grid(column=7,row=a_y)
+    tkinter.Button(
+        top,
+        text='计算(y)',
+        command=Cul_Y,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    tkinter.Button(
+        top,
+        text='二分法计算(x)',
+        command=Cul_X,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=6,
+        row=a_y)
+    tkinter.Button(
+        top,
+        text='梯度法计算(x)',
+        command=Cul_X_TD,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=7,
+        row=a_y)
 
     a_y += 1
-    #绘制函数坐标表格
-    tkinter.Button(top,text='查看记忆',command=Cul_Y_Check,font=FONT,width=width_B,height=height_B).grid(column = 5,row = a_y)
-    tkinter.Button(top, text='隐藏记忆', command=Cul_Y_YC, font=FONT, width=width_B, height=height_B).grid(column=6,row=a_y)
-    tkinter.Button(top,text='清空记忆',command=Cul_Y_Clear,font=FONT,width=width_B,height=height_B).grid(column = 7,row = a_y)
+    # 绘制函数坐标表格
+    tkinter.Button(
+        top,
+        text='查看记忆',
+        command=Cul_Y_Check,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)
+    tkinter.Button(
+        top,
+        text='隐藏记忆',
+        command=Cul_Y_YC,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=6,
+        row=a_y)
+    tkinter.Button(
+        top,
+        text='清空记忆',
+        command=Cul_Y_Clear,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=7,
+        row=a_y)
 
     a_y += 1
-    #显示函数
-    Y_cul=tkinter.Listbox(top,width=width_B*3+2,height=17)#暂时不启用多选
-    Y_cul.grid(column = 5,row = a_y,columnspan = 3,sticky = tkinter.N+tkinter.E+tkinter.W)
+    # 显示函数
+    Y_cul = tkinter.Listbox(top, width=width_B * 3 + 2, height=17)  # 暂时不启用多选
+    Y_cul.grid(
+        column=5,
+        row=a_y,
+        columnspan=3,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    #设置坐标系刻度
-    tkinter.Label(top,font=FONT,text='X轴(函数):',width=width_B,height=height_B).grid(column = 5,row = a_y,sticky = tkinter.N)#设置说明
-    XK_Input = tkinter.Entry(top,width=width_B * 2)
-    XK_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.N+tkinter.E+tkinter.W)
+    # 设置坐标系刻度
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='X轴(函数):',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y,
+        sticky=tkinter.N)  # 设置说明
+    XK_Input = tkinter.Entry(top, width=width_B * 2)
+    XK_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    #设置坐标系刻度
-    tkinter.Label(top,font=FONT,text='Y轴(函数):',width=width_B,height=height_B).grid(column = 5,row = a_y)#设置说明
-    YK_Input = tkinter.Entry(top,width=width_B * 2)
-    YK_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 设置坐标系刻度
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='Y轴(函数):',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    YK_Input = tkinter.Entry(top, width=width_B * 2)
+    YK_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    #设置坐标系刻度
-    tkinter.Label(top,font=FONT,text='X轴极限:',width=width_B,height=height_B).grid(column = 5,row = a_y)#设置说明
-    Xlim_Input = tkinter.Entry(top,width=width_B * 2)
-    Xlim_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 设置坐标系刻度
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='X轴极限:',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    Xlim_Input = tkinter.Entry(top, width=width_B * 2)
+    Xlim_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    #设置坐标系刻度
-    tkinter.Label(top,font=FONT,text='Y轴极限:',width=width_B,height=height_B).grid(column = 5,row = a_y)#设置说明
-    Ylim_Input = tkinter.Entry(top,width=width_B * 2)
-    Ylim_Input.grid(column = 6,row = a_y,columnspan = 2,sticky = tkinter.E+tkinter.W)
+    # 设置坐标系刻度
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='Y轴极限:',
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 设置说明
+    Ylim_Input = tkinter.Entry(top, width=width_B * 2)
+    Ylim_Input.grid(
+        column=6,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top, text='绘制函数', command=Fucn_Draw, font=FONT, width=width_B, height=height_B).grid(column=5,row=a_y)  # 绘制函数
-    tkinter.Button(top, text='计算性质', command=Fucn_XZ, font=FONT, width=width_B, height=height_B).grid(column=6,
-                                                                                                        row=a_y)  # 绘制函数
-    tkinter.Button(top, text='创建导函数', command=Fucn_DHS, font=FONT, width=width_B, height=height_B).grid(column=7,
-                                                                                                        row=a_y)  # 绘制函数
+    tkinter.Button(
+        top,
+        text='绘制函数',
+        command=Fucn_Draw,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=5,
+        row=a_y)  # 绘制函数
+    tkinter.Button(
+        top,
+        text='计算性质',
+        command=Fucn_XZ,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=6,
+        row=a_y)  # 绘制函数
+    tkinter.Button(
+        top,
+        text='创建导函数',
+        command=Fucn_DHS,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=7,
+        row=a_y)  # 绘制函数
     a_y += 1
     XZ_box = tkinter.Listbox(top, width=width_B * 3 + 2, height=10)  # 暂时不启用多选
-    XZ_box.grid(column=5, row=a_y, columnspan=3, sticky=tkinter.N + tkinter.E + tkinter.W)
+    XZ_box.grid(
+        column=5,
+        row=a_y,
+        columnspan=3,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
     a_y += 1
     News_box = tkinter.Listbox(top, width=width_B * 3 + 2, height=5)  # 暂时不启用多选
-    News_box.grid(column=5, row=a_y, columnspan=3, sticky=tkinter.N + tkinter.E + tkinter.W)
-
-
-    tkinter.Label(top, font=FONT, text='',  width=1).grid(column=8, row=a_y)  # 占用第四
+    News_box.grid(
+        column=5,
+        row=a_y,
+        columnspan=3,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+
+    tkinter.Label(
+        top,
+        font=FONT,
+        text='',
+        width=1).grid(
+        column=8,
+        row=a_y)  # 占用第四
     a_y = 0
 
-    #绘制函数坐标表格
-    tkinter.Button(top,text='导入表格',command=Fucn_Cul_CSV,font=FONT,width=width_B,height=height_B).grid(column = 9,row = a_y)
-    tkinter.Button(top,text='生成表格',command=Fucn_Numpy,font=FONT,width=width_B,height=height_B).grid(column = 10,row = a_y)
-    tkinter.Button(top,text='导出表格',command=Fucn_Save,font=FONT,width=width_B,height=height_B).grid(column = 11,row = a_y)
+    # 绘制函数坐标表格
+    tkinter.Button(
+        top,
+        text='导入表格',
+        command=Fucn_Cul_CSV,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=9,
+        row=a_y)
+    tkinter.Button(
+        top,
+        text='生成表格',
+        command=Fucn_Numpy,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=10,
+        row=a_y)
+    tkinter.Button(
+        top,
+        text='导出表格',
+        command=Fucn_Save,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=11,
+        row=a_y)
 
     a_y += 1
-    #显示函数的xy
-    Pr_BOX=tkinter.Listbox(top,width=width_B*3+2)#暂时不启用多选
-    Pr_BOX.grid(column = 9,row = a_y,columnspan = 3,rowspan = TD_a_y + 4,sticky = tkinter.S+tkinter.N+tkinter.E+tkinter.W)
+    # 显示函数的xy
+    Pr_BOX = tkinter.Listbox(top, width=width_B * 3 + 2)  # 暂时不启用多选
+    Pr_BOX.grid(
+        column=9,
+        row=a_y,
+        columnspan=3,
+        rowspan=TD_a_y +
+        4,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     addNews('加载完成,欢迎使用!')
-    top.mainloop()
+    top.mainloop()

+ 1335 - 349
HSCH/Func_advanced.py

@@ -1,54 +1,71 @@
-from __future__ import division#让/恢复为除法
+from __future__ import division  # 让/恢复为除法
 import sympy
 from matplotlib import pyplot as plt
 from matplotlib import rcParams
-import tkinter,tkinter.messagebox
+import tkinter
+import tkinter.messagebox
 import random
 from New_TK import DragWindow
 from matplotlib.animation import FuncAnimation
 from HSCH.HS import HS_lambda as HS_L
 import numpy as np
 
-def Float(IN,si = float,n = True):#Float筛选系统
+
+def Float(IN, si=float, n=True):  # Float筛选系统
     x = []
     for i in IN:
         try:
-            if si(i) == si(0) and n: continue
+            if si(i) == si(0) and n:
+                continue
             x.append(si(i))
         except ValueError:
             pass
     return x
 
-def Fucn_Save():#导出CSV
+
+def Fucn_Save():  # 导出CSV
     try:
-        succ = HS.Out()#是否成功
+        succ = HS.Out()  # 是否成功
         if not succ:
             raise Exception
         addNews('CSV导出成功')
-    except:
+    except BaseException:
         addNews('CSV导出失败')
 
-def Fucn_Numpy():#生成表格
-    global HS,Pr_BOX
+
+def Fucn_Numpy():  # 生成表格
+    global HS, Pr_BOX
     try:
         Pr_BOX.delete(0, tkinter.END)
-        Pr_BOX.insert(tkinter.END,*HS.returnList())
+        Pr_BOX.insert(tkinter.END, *HS.returnList())
         addNews('表格创建成功')
-    except:
+    except BaseException:
         addNews('无法创建表格')
 
+
 def Change_Sympy(c):
     try:
-        Name = {'Pi': sympy.pi, 'e': sympy.E, 'log': sympy.log,
-                'sin': sympy.sin, 'cos': sympy.cos, 'tan': sympy.tan,
-                'cot': lambda x: 1 / sympy.tan(x), 'csc': lambda x: 1 / sympy.sin(x),
-                'sec': lambda x: 1 / sympy.cos(x), 'sinh': sympy.sinh, 'cosh': sympy.cosh,
-                'tanh': sympy.tanh, 'asin': sympy.asin, 'acos': sympy.acos,
-                'atan': sympy.atan}
+        Name = {
+            'Pi': sympy.pi,
+            'e': sympy.E,
+            'log': sympy.log,
+            'sin': sympy.sin,
+            'cos': sympy.cos,
+            'tan': sympy.tan,
+            'cot': lambda x: 1 / sympy.tan(x),
+            'csc': lambda x: 1 / sympy.sin(x),
+            'sec': lambda x: 1 / sympy.cos(x),
+            'sinh': sympy.sinh,
+            'cosh': sympy.cosh,
+            'tanh': sympy.tanh,
+            'asin': sympy.asin,
+            'acos': sympy.acos,
+            'atan': sympy.atan}
         ans = eval(c, Name)
-        return ans,True
-    except:
-        return None,False
+        return ans, True
+    except BaseException:
+        return None, False
+
 
 def Change_S(c):
     get = Change_Sympy(c)
@@ -56,58 +73,63 @@ def Change_S(c):
         get[0] = c
     return get[0]
 
+
 def Check_Center_of_symmetry():
-    global HS,YC_Input, YC_BOX,XZ_JD
-    a,must = Change_Sympy(XZ_JD.get())
+    global HS, YC_Input, YC_BOX, XZ_JD
+    a, must = Change_Sympy(XZ_JD.get())
     try:
-        G = HS.Check_Center_of_symmetry(Change_S(YC_Input.get()),addNews,a)
+        G = HS.Check_Center_of_symmetry(Change_S(YC_Input.get()), addNews, a)
         if G[1]:
-            YC_BOX.insert(tkinter.END,G[1])
+            YC_BOX.insert(tkinter.END, G[1])
             addNews('预测完成')
         else:
             raise Exception
-    except:
+    except BaseException:
         addNews('预测失败')
 
+
 def Check_Symmetry_axis():
-    global HS,YC_Input, YC_BOX,XZ_JD
-    a,must = Change_Sympy(XZ_JD.get())
+    global HS, YC_Input, YC_BOX, XZ_JD
+    a, must = Change_Sympy(XZ_JD.get())
     try:
-        G = HS.Check_Symmetry_axis(Change_S(YC_Input.get()),addNews,a)
+        G = HS.Check_Symmetry_axis(Change_S(YC_Input.get()), addNews, a)
         if G[1]:
-            YC_BOX.insert(tkinter.END,G[1])
+            YC_BOX.insert(tkinter.END, G[1])
             addNews('预测完成')
         else:
             raise Exception
-    except:
+    except BaseException:
         addNews('预测失败')
 
+
 def Check_Periodic():
-    global HS,YC_Input, YC_BOX,XZ_JD
-    a,must = Change_Sympy(XZ_JD.get())
+    global HS, YC_Input, YC_BOX, XZ_JD
+    a, must = Change_Sympy(XZ_JD.get())
     try:
-        G = HS.Check_Periodic(Change_S(YC_Input.get()),addNews,a)
+        G = HS.Check_Periodic(Change_S(YC_Input.get()), addNews, a)
         if G[1]:
-            YC_BOX.insert(tkinter.END,G[1])
+            YC_BOX.insert(tkinter.END, G[1])
             addNews('预测完成')
         else:
             raise Exception
-    except:
+    except BaseException:
         addNews('预测失败')
 
+
 def Check_Monotonic():
-    global HS,YC_Input, YC_BOX,XZ_JD
-    a,must = Change_Sympy(XZ_JD.get())
+    global HS, YC_Input, YC_BOX, XZ_JD
+    a, must = Change_Sympy(XZ_JD.get())
     try:
-        G = HS.Check_Monotonic(YC_Input.get(),addNews,a)
+        G = HS.Check_Monotonic(YC_Input.get(), addNews, a)
         if G[1]:
-            YC_BOX.insert(tkinter.END,G[1])
+            YC_BOX.insert(tkinter.END, G[1])
             addNews('预测完成')
         else:
             raise Exception
-    except:
+    except BaseException:
         addNews('预测失败')
 
+
 def Cul_Y_Clear():
     global HS
     try:
@@ -117,51 +139,56 @@ def Cul_Y_Clear():
             addNews('删除完毕')
         else:
             addNews('删除取消')
-    except:
+    except BaseException:
         addNews('删除失败')
 
-def Cul_Y_YC():#显示xy
-    global HS,R_cul
+
+def Cul_Y_YC():  # 显示xy
+    global HS, R_cul
     try:
         R_cul.delete(0, tkinter.END)
         HS.YC_On_Off()
         addNews('已清空卡槽')
-    except:
+    except BaseException:
         addNews('隐藏(显示)失败')
 
 
-def Cul_Y_Check():#显示xy
-    global HS,R_cul
+def Cul_Y_Check():  # 显示xy
+    global HS, R_cul
     try:
         Fucn = HS[lb.curselection()[0]]
         R_cul.delete(0, tkinter.END)
-        m_x,m_y = Fucn.getMemory()
+        m_x, m_y = Fucn.getMemory()
         answer = []
         for i in range(len(m_x)):
             answer.append(f'x={m_x[i]} -> y={m_y[i]}')
         R_cul.insert(tkinter.END, *answer)
         addNews('输出完成')
-    except:
+    except BaseException:
         addNews('操作失败')
 
+
 def Cul_X_TD():
-    global HS,Xcul_TD_Input, Xcul_TD_CS, R_cul
+    global HS, Xcul_TD_Input, Xcul_TD_CS, R_cul
     try:
         addNews('计算过程程序可能无响应')
-        R_cul.delete(0, tkinter.END)#清空
+        R_cul.delete(0, tkinter.END)  # 清空
         E = []
         for i in Xcul_TD_CS:
             E.append(i.get())
         addNews('系统运算中')
-        answer = HS.Iterative_method_Of_Huan(Xcul_TD_Input.get(),*E)
-        if answer[1] != None:
+        answer = HS.Iterative_method_Of_Huan(Xcul_TD_Input.get(), *E)
+        if answer[1] is not None:
             R_cul.insert(tkinter.END, answer[0])
             addNews('系统运算完成')
-        else:addNews('系统运算无结果')
-    except :
+        else:
+            addNews('系统运算无结果')
+    except BaseException:
         addNews('系统运算失败,请注意参数设置')
+
+
 def Cul_Y():
-    global Ycul_Input,HS,R_cul
+    global Ycul_Input, HS, R_cul
     try:
         addNews('计算过程程序可能无响应')
         R_cul.delete(0, tkinter.END)
@@ -172,28 +199,30 @@ def Cul_Y():
             addNews('系统运算完毕')
         else:
             addNews('系统运算无结果')
-    except:
+    except BaseException:
         addNews('计算失败')
 
+
 def Cul_X_Sympy():
-    global Xcul_DS_Input,HS,R_cul
+    global Xcul_DS_Input, HS, R_cul
     try:
         addNews('计算过程程序可能无响应')
         R_cul.delete(0, tkinter.END)
         x = Xcul_DS_Input.get().split(',')
         answer = []
         for i in x:
-            answer +=  HS.Sympy_Cul(i)[0]
+            answer += HS.Sympy_Cul(i)[0]
         if answer != []:
             R_cul.insert(tkinter.END, *answer)
             addNews('系统运算完毕')
         else:
             addNews('系统运算无结果')
-    except:
+    except BaseException:
         addNews('计算失败')
 
+
 def Cul_DS():
-    global DScul_Input,HS,R_cul,DScul_JD_Input
+    global DScul_Input, HS, R_cul, DScul_JD_Input
     try:
         addNews('计算过程程序可能无响应')
         R_cul.delete(0, tkinter.END)
@@ -201,8 +230,8 @@ def Cul_DS():
         JD = DScul_JD_Input.get()
         answer = []
         for i in x:
-            get = HS.Sympy_DHS(i,JD)[0]
-            if get != None:
+            get = HS.Sympy_DHS(i, JD)[0]
+            if get is not None:
                 answer.append(get)
         if answer != []:
             R_cul.insert(tkinter.END, *answer)
@@ -212,8 +241,9 @@ def Cul_DS():
     except IndexError:
         addNews('计算失败')
 
+
 def Cul_DS_BJ():
-    global DScul_Input,HS,R_cul,DScul_JD_Input
+    global DScul_Input, HS, R_cul, DScul_JD_Input
     try:
         addNews('计算过程程序可能无响应')
         R_cul.delete(0, tkinter.END)
@@ -221,8 +251,8 @@ def Cul_DS_BJ():
         JD = DScul_JD_Input.get()
         answer = []
         for i in x:
-            get = HS.Sympy_DHS(i,JD,True)[0]
-            if get != None:
+            get = HS.Sympy_DHS(i, JD, True)[0]
+            if get is not None:
                 answer.append(get)
         if answer != []:
             R_cul.insert(tkinter.END, *answer)
@@ -232,100 +262,126 @@ def Cul_DS_BJ():
     except IndexError:
         addNews('计算失败')
 
+
 def Cul_X():
-    global Xcul_Input, Xcul_CS,HS,R_cul
+    global Xcul_Input, Xcul_CS, HS, R_cul
     try:
         addNews('计算过程程序可能无响应')
-        R_cul.delete(0, tkinter.END)#清空
-        y = Xcul_Input.get().split(',')#拆解输入
-        E = [100,0.0001,0.1,0.5,False,True,1000,0.1,0.1,False,None]
+        R_cul.delete(0, tkinter.END)  # 清空
+        y = Xcul_Input.get().split(',')  # 拆解输入
+        E = [100, 0.0001, 0.1, 0.5, False, True, 1000, 0.1, 0.1, False, None]
         for i in range(11):
             try:
-                if i in (4,5,9):
+                if i in (4, 5, 9):
                     a = Xcul_CS[i].get()
                 else:
                     a = float(Xcul_CS[i].get())
                 E[i] = a
-            except:
+            except BaseException:
                 pass
         answer = []
         addNews('系统运算中')
         for i in y:
             try:
-                answer += HS.Cul_dichotomy(float(i),*E)[0]
-            except:pass
+                answer += HS.Cul_dichotomy(float(i), *E)[0]
+            except BaseException:
+                pass
         if answer:
             addNews('系统运算完成')
             R_cul.insert(tkinter.END, *answer)
-        else:addNews('系统运算无结果')
-    except :
+        else:
+            addNews('系统运算无结果')
+    except BaseException:
         addNews('系统运算失败')
 
+
 def Fucn_XZ():
-    global HS,lb,XZ_BOX,XZ_JD
+    global HS, lb, XZ_BOX, XZ_JD
     try:
         a, must = Change_Sympy(XZ_JD.get())
         addNews('预测过程程序可能无响应')
         XZ_BOX.delete(0, tkinter.END)
-        answer = HS.Nature(addNews,True,a,must)
+        answer = HS.Nature(addNews, True, a, must)
         XZ_BOX.insert(tkinter.END, *answer)
         addNews('性质预测完成')
     except IndexError:
         addNews('性质预测失败')
 
+
 def Fucn_Draw():
-    global XZ_Input,XZstart_Input,XZend_Input,XZkd_Input,YZ_Input,YZstart_Input,YZend_Input,YZkd_Input
-    global Xlimstart_Input,Xlimend_Input,Ylimstart_Input,Ylimend_Input
-    global HS,fig,Point_Draw, Best_Draw, Test_Draw,Draw_BOX,ZL_Input
+    global XZ_Input, XZstart_Input, XZend_Input, XZkd_Input, YZ_Input, YZstart_Input, YZend_Input, YZkd_Input
+    global Xlimstart_Input, Xlimend_Input, Ylimstart_Input, Ylimend_Input
+    global HS, fig, Point_Draw, Best_Draw, Test_Draw, Draw_BOX, ZL_Input
     try:
         Draw_Type = Draw_BOX.curselection()[0]
-    except:
+    except BaseException:
         Draw_Type = 0
-    #画板创造
+    # 画板创造
     addNews('生成绘制取...')
     fig = plt.figure(num='CoTan函数')  # 定义一个图像窗口
-    if Draw_Type in (0,1,2,3,8,9):
-        plt.grid(True,ls='--')  # 显示网格(不能放到后面,因为后面调整成为了笛卡尔坐标系)
+    if Draw_Type in (0, 1, 2, 3, 8, 9):
+        plt.grid(True, ls='--')  # 显示网格(不能放到后面,因为后面调整成为了笛卡尔坐标系)
     ax = plt.gca()
+
     def init():
-        if Draw_Type in (0,2,4,6,8):
+        if Draw_Type in (0, 2, 4, 6, 8):
             ax.spines['right'].set_color('none')
             ax.spines['top'].set_color('none')
             ax.xaxis.set_ticks_position('bottom')
             ax.yaxis.set_ticks_position('left')
-            ax.spines['bottom'].set_position(('data', 0))# 设置x轴, y轴在(0, 0)的位置
+            ax.spines['bottom'].set_position(('data', 0))  # 设置x轴, y轴在(0, 0)的位置
             ax.spines['left'].set_position(('data', 0))
-        #检测x
+        # 检测x
         try:
-            if XZ_Input.get()[0] == 'c':#如果输入函数cx#-10#10#1#1
-                _HS = [XZ_Input.get()[1:],XZstart_Input.get(),XZend_Input.get(),XZkd_Input.get(),2]#第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
-                P = ['x',-10,10,1,2]#保护系统
+            if XZ_Input.get()[0] == 'c':  # 如果输入函数cx#-10#10#1#1
+                _HS = [
+                    XZ_Input.get()[
+                        1:],
+                    XZstart_Input.get(),
+                    XZend_Input.get(),
+                    XZkd_Input.get(),
+                    2]  # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
+                P = ['x', -10, 10, 1, 2]  # 保护系统
                 try:
                     P[0] = _HS[0]
                     P[1] = int(_HS[1])
                     P[2] = int(_HS[2])
                     P[3] = int(_HS[3])
                     P[4] = int(_HS[4])
-                except:#迭代匹配直到出现错误
+                except BaseException:  # 迭代匹配直到出现错误
                     pass
                 _HS = P
-                x = Float(HS_L(_HS[0],'x','',_HS[1],_HS[2],_HS[3],_HS[4]).Cul()[1])#取y
+                x = Float(
+                    HS_L(
+                        _HS[0],
+                        'x',
+                        '',
+                        _HS[1],
+                        _HS[2],
+                        _HS[3],
+                        _HS[4]).Cul()[1])  # 取y
                 ax.set_xticks(x)
-            elif XZ_Input.get()[0] == 'y':#输入函数y
-                #不错要错误捕捉,外围有个大的捕捉
+            elif XZ_Input.get()[0] == 'y':  # 输入函数y
+                # 不错要错误捕捉,外围有个大的捕捉
                 x = abs(int(XZstart_Input.get()))
-                x_major_locator=plt.MultipleLocator(x)
+                x_major_locator = plt.MultipleLocator(x)
                 ax.xaxis.set_major_locator(x_major_locator)
-            else:#输入纯数字
+            else:  # 输入纯数字
                 x = Float(XZ_Input.get().split(','))
                 ax.set_xticks(x)
-        except:
+        except BaseException:
             x_major_locator = plt.MultipleLocator(2)
             ax.xaxis.set_major_locator(x_major_locator)
-        #检测y
-        try:#意外捕捉
+        # 检测y
+        try:  # 意外捕捉
             if YZ_Input.get()[0] == 'c':  # 如果输入函数cx#-10#10#1#1
-                _HS = [YZ_Input.get()[1:],YZstart_Input.get(),YZend_Input.get(),YZkd_Input.get(),2]  # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
+                _HS = [
+                    YZ_Input.get()[
+                        1:],
+                    YZstart_Input.get(),
+                    YZend_Input.get(),
+                    YZkd_Input.get(),
+                    2]  # 第一部分HS,第二部分S,第三部分E,第四部分KD,第五部分JD
                 P = ['x', -10, 10, 1, 2]  # 保护系统
                 try:
                     P[0] = _HS[0]
@@ -333,10 +389,18 @@ def Fucn_Draw():
                     P[2] = int(_HS[2])
                     P[3] = int(_HS[3])
                     P[4] = int(_HS[4])
-                except:  # 迭代匹配直到出现错误
+                except BaseException:  # 迭代匹配直到出现错误
                     pass
                 _HS = P
-                y = Float(HS_L(_HS[0], 'y', '', _HS[1], _HS[2], _HS[3], _HS[4]).Cul()[1])  # 取y
+                y = Float(
+                    HS_L(
+                        _HS[0],
+                        'y',
+                        '',
+                        _HS[1],
+                        _HS[2],
+                        _HS[3],
+                        _HS[4]).Cul()[1])  # 取y
                 ax.set_yticks(y)
             elif YZ_Input.get()[0] == 'y':  # 输入函数y
                 y = abs(int(YZstart_Input.get()))
@@ -345,33 +409,40 @@ def Fucn_Draw():
             else:
                 y = Float(YZ_Input.get().split(','))
                 ax.set_yticks(y)
-        except:
+        except BaseException:
             y_major_locator = plt.MultipleLocator(2)
             ax.yaxis.set_major_locator(y_major_locator)
-        #极限设计
+        # 极限设计
         try:
-            xlim_IN = Float([Xlimstart_Input.get(),Xlimend_Input.get()],si=int,n=False)
-            ylim_IN = Float([Ylimstart_Input.get(),Ylimend_Input.get()],si=int,n=False)
-            try:_xlim = [xlim_IN[0], xlim_IN[1]]
-            except:_xlim = [-10,10]
-            try:_ylim = [ylim_IN[0], ylim_IN[1]]
-            except:_ylim = _xlim
-        except:
+            xlim_IN = Float(
+                [Xlimstart_Input.get(), Xlimend_Input.get()], si=int, n=False)
+            ylim_IN = Float(
+                [Ylimstart_Input.get(), Ylimend_Input.get()], si=int, n=False)
+            try:
+                _xlim = [xlim_IN[0], xlim_IN[1]]
+            except BaseException:
+                _xlim = [-10, 10]
+            try:
+                _ylim = [ylim_IN[0], ylim_IN[1]]
+            except BaseException:
+                _ylim = _xlim
+        except BaseException:
             _xlim = [-10, 10]
-            _ylim = [-10,10]
+            _ylim = [-10, 10]
         _xlim.sort()
         _ylim.sort()
         ax.set_xlim(_xlim)
         ax.set_ylim(_ylim)
-        global text_x,text_y
+        global text_x, text_y
         text_x = _xlim[0] + abs(_xlim[0]) * 0.01
         text_y = _ylim[1] - abs(_ylim[1]) * 0.01
     init()
-    #函数绘图系统
+    # 函数绘图系统
     addNews('图像绘制中...')
-    if HS == None:return False
-    if Draw_Type in (0,1,4,5):
-        #绘制曲线
+    if HS is None:
+        return False
+    if Draw_Type in (0, 1, 4, 5):
+        # 绘制曲线
         get = HS.Draw_Cul()
         fx = get[0]
         fy = get[1]
@@ -382,51 +453,72 @@ def Fucn_Draw():
             x = fx[i]
             y = fy[i]
             if First:
-                plt.plot(x, y,View,label = Func_label)  # plot()画出曲线
+                plt.plot(x, y, View, label=Func_label)  # plot()画出曲线
                 First = False
             else:
                 plt.plot(x, y, View)
-        #绘制记忆点
+        # 绘制记忆点
         get = HS.getMemory()
         m_x = get[0]
         m_y = get[1]
         max_x, max_y, min_x, min_y = HS.Best_value()
         if Point_Draw.get():
-            plt.plot(m_x, m_y, View[0]+'o',label=f'Point of {Func_label}')  # 画出一些点
-            len_x = sorted(list(set(m_x)))#去除list重复项目
+            plt.plot(
+                m_x,
+                m_y,
+                View[0] + 'o',
+                label=f'Point of {Func_label}')  # 画出一些点
+            len_x = sorted(list(set(m_x)))  # 去除list重复项目
             JZD = max_x + min_x
 
             if Test_Draw.get():
                 o_x = None
                 for i in range(len(len_x)):
-                    if i in JZD:continue#去除极值点
-                    _x = len_x[i]#x
-                    if o_x == None or abs(_x - o_x) >= 1:#确保位置
-                        num = m_x.index(_x)#y的座位
+                    if i in JZD:
+                        continue  # 去除极值点
+                    _x = len_x[i]  # x
+                    if o_x is None or abs(_x - o_x) >= 1:  # 确保位置
+                        num = m_x.index(_x)  # y的座位
                         _y = m_y[num]
-                        plt.text(_x,_y,f'({_x},{int(_y)})', fontdict={'size': '10', 'color':'b'})# 标出坐标
+                        plt.text(
+                            _x, _y, f'({_x},{int(_y)})', fontdict={
+                                'size': '10', 'color': 'b'})  # 标出坐标
                         o_x = _x
         if Best_Draw.get():
             o_x = None
             n_max = []
-            for i in range(len(max_x)):#画出最大值
+            for i in range(len(max_x)):  # 画出最大值
                 _x = max_x[i]
-                if o_x == None or abs(_x - o_x) >= 1:  # 确保位置
-                    if Test_Draw.get():plt.text(_x-1, max_y, f'max:({_x},{int(max_y)})', fontdict={'size': '10', 'color': 'b'})  # 标出坐标
+                if o_x is None or abs(_x - o_x) >= 1:  # 确保位置
+                    if Test_Draw.get():
+                        plt.text(
+                            _x - 1,
+                            max_y,
+                            f'max:({_x},{int(max_y)})',
+                            fontdict={
+                                'size': '10',
+                                'color': 'b'})  # 标出坐标
                     n_max.append(_x)
                     o_x = _x
             o_x = None
             n_min = []
-            for i in range(len(min_x)):#画出最小值
+            for i in range(len(min_x)):  # 画出最小值
                 _x = min_x[i]
-                if o_x == None or abs(_x - o_x) >= 1:
+                if o_x is None or abs(_x - o_x) >= 1:
                     n_min.append(_x)
-                    if Test_Draw.get():plt.text(_x-1, min_y, f'min:({_x},{int(min_y)})', fontdict={'size': '10', 'color': 'b'})  # 标出坐标
+                    if Test_Draw.get():
+                        plt.text(
+                            _x - 1,
+                            min_y,
+                            f'min:({_x},{int(min_y)})',
+                            fontdict={
+                                'size': '10',
+                                'color': 'b'})  # 标出坐标
                     o_x = _x
             plt.plot(n_min, [min_y] * len(n_min), View[0] + 'o')  # 画出一些点
             plt.plot(n_max, [max_y] * len(n_max), View[0] + 'o')  # 画出一些点
         plt.legend()  # 显示图示
-    elif Draw_Type in (8,9):
+    elif Draw_Type in (8, 9):
         get = HS.Cul()
         x = get[0]
         y = get[1]
@@ -436,13 +528,17 @@ def Fucn_Draw():
         ydata = []
         Func_label = get[2]
         View = get[3]
-        ln = ax.plot([], [], View,label=Func_label,animated=False)[0]
-        text = plt.text(text_x, text_y, '', fontdict={'size': '10', 'color': 'b'})
+        ln = ax.plot([], [], View, label=Func_label, animated=False)[0]
+        text = plt.text(
+            text_x, text_y, '', fontdict={
+                'size': '10', 'color': 'b'})
+
         def _init():
             init()
-            return ln,text
+            return ln, text
+
         def update(n):
-            global xdata,ydata
+            global xdata, ydata
             if n == 0:
                 xdata = []
                 ydata = []
@@ -450,19 +546,28 @@ def Fucn_Draw():
             ydata.append(y[n])
             text.set_text(f'x={x[n]},y={y[n]}')
             ln.set_data(xdata, ydata)
-            return ln,text
-        try:#自定义帧率
+            return ln, text
+        try:  # 自定义帧率
             ZL = int(ZL_Input.get())
-        except:
+        except BaseException:
             ZL = 100
-        ani = FuncAnimation(fig, update, frames=l,init_func=_init, interval=ZL,blit=False,repeat_delay=3000)#动态绘图
-    elif Draw_Type in (2,3,6,7):
-        text = plt.text(text_x, text_y, '', fontdict={'size': '10', 'color': 'b'})
+        ani = FuncAnimation(
+            fig,
+            update,
+            frames=l,
+            init_func=_init,
+            interval=ZL,
+            blit=False,
+            repeat_delay=3000)  # 动态绘图
+    elif Draw_Type in (2, 3, 6, 7):
+        text = plt.text(
+            text_x, text_y, '', fontdict={
+                'size': '10', 'color': 'b'})
         HS_List = HS.Return_Son()
         pr_List = []
         l = len(HS_List)
-        m = []#每个群组中fx分类的个数
-        for i in HS_List:#预先生成函数
+        m = []  # 每个群组中fx分类的个数
+        for i in HS_List:  # 预先生成函数
             addNews(f'迭代计算中...(共{l}次)')
             get = i.Draw_Cul()
             m.append(len(get[0]))
@@ -470,421 +575,1302 @@ def Fucn_Draw():
         pr_List += pr_List[::-1]
         ln_list = [text]
         for i in range(max(m)):
-            ln_list.append(ax.plot([], [], pr_List[0][3], animated=False)[0])#创建足够的i
+            ln_list.append(
+                ax.plot(
+                    [],
+                    [],
+                    pr_List[0][3],
+                    animated=False)[0])  # 创建足够的i
         l = len(pr_List)
+
         def _init():
             init()
             text.set_text('')
             return None
+
         def update(n):
-            get = pr_List[n-1]
+            get = pr_List[n - 1]
             ln_list[0].set_text(get[2])
             for i in range(max(m)):
                 try:
                     x = get[0][i]
                     y = get[1][i]
-                    ln_list[i+1].set_data(x, y)
-                except:
-                    ln_list[i+1].set_data([],[])
+                    ln_list[i + 1].set_data(x, y)
+                except BaseException:
+                    ln_list[i + 1].set_data([], [])
             return ln_list
-        try:#自定义帧率
+        try:  # 自定义帧率
             ZL = int(ZL_Input.get())
-        except:
+        except BaseException:
             ZL = 100
-        ani = FuncAnimation(fig, update, frames=l,init_func=_init, interval=ZL,blit=False)#动态绘图
+        ani = FuncAnimation(
+            fig,
+            update,
+            frames=l,
+            init_func=_init,
+            interval=ZL,
+            blit=False)  # 动态绘图
     addNews('绘制完毕')
     plt.show()  # 显示图像
     return True
 
+
 def Add_HS():
-    global Func_Input, start_Input, end_Input, kd_Input, JD_Input, FuncName_Input, FuncView_Input,View_C,View_Co,HS,top
+    global Func_Input, start_Input, end_Input, kd_Input, JD_Input, FuncName_Input, FuncView_Input, View_C, View_Co, HS, top
     global a_MR, a_start, a_end, a_kd
     getHS = Func_Input.get().replace(' ', '')
     if getHS == '':
         addNews('应用失败')
         return None
-    X_I = [-10,10,0.1,2,1,-10,10,1]
-    get = [start_Input,end_Input,kd_Input,JD_Input,a_MR, a_start, a_end, a_kd]
-    #参数的处理
+    X_I = [-10, 10, 0.1, 2, 1, -10, 10, 1]
+    get = [
+        start_Input,
+        end_Input,
+        kd_Input,
+        JD_Input,
+        a_MR,
+        a_start,
+        a_end,
+        a_kd]
+    # 参数的处理
     try:
         c = kd_Input.get().replace(' ', '')
         if c[0] == 'H':
-            Name = {'Pi': sympy.pi, 'e': sympy.E, 'log': sympy.log,
-                'sin': sympy.sin, 'cos': sympy.cos, 'tan': sympy.tan,
-                'cot': lambda x: 1 / sympy.tan(x), 'csc': lambda x: 1 / sympy.sin(x),
-                'sec': lambda x: 1 / sympy.cos(x), 'sinh': sympy.sinh, 'cosh': sympy.cosh,
-                'tanh': sympy.tanh, 'asin': sympy.asin, 'acos': sympy.acos,
+            Name = {
+                'Pi': sympy.pi,
+                'e': sympy.E,
+                'log': sympy.log,
+                'sin': sympy.sin,
+                'cos': sympy.cos,
+                'tan': sympy.tan,
+                'cot': lambda x: 1 / sympy.tan(x),
+                'csc': lambda x: 1 / sympy.sin(x),
+                'sec': lambda x: 1 / sympy.cos(x),
+                'sinh': sympy.sinh,
+                'cosh': sympy.cosh,
+                'tanh': sympy.tanh,
+                'asin': sympy.asin,
+                'acos': sympy.acos,
                 'atan': sympy.atan}
-            kd = eval(c[1:],Name)
-        else:raise Exception
-    except:
+            kd = eval(c[1:], Name)
+        else:
+            raise Exception
+    except BaseException:
         kd = None
     for i in range(8):
         try:
             a = float(get[i].get())
             X_I[i] = a
-        except:
+        except BaseException:
             pass
-    if kd != None:X_I[2] = kd
+    if kd is not None:
+        X_I[2] = kd
 
-    #View的处理
+    # View的处理
     view = FuncView_Input.get().split('#')
     try:
-        if view[0] not in View_Co:view[0] = 'b'
+        if view[0] not in View_Co:
+            view[0] = 'b'
         v_2 = View_C.get(view[1], '-')
-    except:
-        view = ['','']
+    except BaseException:
+        view = ['', '']
         view[0] = random.choice(View_Co)
         v_2 = '-'
     V = view[0] + v_2
-    #Name的处理
+    # Name的处理
     name = FuncName_Input.get().replace(' ', '')
-    if name == '':name = getHS
+    if name == '':
+        name = getHS
     try:
-        HS = HS_L(getHS,name,V,*X_I,c_Son = True)
+        HS = HS_L(getHS, name, V, *X_I, c_Son=True)
         addNews('应用成功')
         top.title(f'CoTan函数工厂  {HS}')
-    except:
+    except BaseException:
         addNews('应用失败')
 
+
 def addNews(News):
-    global News_BOX,T,top
+    global News_BOX, T, top
     T += 1
     News = str(News)
-    News_BOX.insert(0, News+f'({T})')
+    News_BOX.insert(0, News + f'({T})')
     top.update()
 
-def Advanced_Control():#H_S-默认函数GF-关闭时询问返回函数
-    global View_C,View_Co,HS,T,top
+
+def Advanced_Control():  # H_S-默认函数GF-关闭时询问返回函数
+    global View_C, View_Co, HS, T, top
     HS = None
     T = 0
-    View_C = {'实线':'-',
-              '短横线':'--',
-              '点划线':'-,',
-              '虚线':':',
-              '点标记':'.',
-              '圆标记':'o',
-              '倒三角':'v',
-              '正三角':'^',
-              '左三角':'&lt',
-              '下箭头':'1',
-              '上箭头':'2',
-              '左箭头':'3',
-              '右箭头':'4',
-              '正方形':'s',
-              '五边形':'p',
-              '星形':'*',
-              '六边形':'h',
-              '六边形2':'H',
-              '+号':'+',
-              'X标记':'x',}#函数样式翻译表
-    View_Co = ['g','r','c','m','y','k']
+    View_C = {'实线': '-',
+              '短横线': '--',
+              '点划线': '-,',
+              '虚线': ':',
+              '点标记': '.',
+              '圆标记': 'o',
+              '倒三角': 'v',
+              '正三角': '^',
+              '左三角': '&lt',
+              '下箭头': '1',
+              '上箭头': '2',
+              '左箭头': '3',
+              '右箭头': '4',
+              '正方形': 's',
+              '五边形': 'p',
+              '星形': '*',
+              '六边形': 'h',
+              '六边形2': 'H',
+              '+号': '+',
+              'X标记': 'x', }  # 函数样式翻译表
+    View_Co = ['g', 'r', 'c', 'm', 'y', 'k']
 
     # top = tkinter.Tk()  # 设置屏幕
     top = DragWindow()
-    bg = '#FFFAFA'#主颜色
-    bbg = '#FFFAFA'#按钮颜色
-    fg = '#000000'#文字颜色
+    bg = '#FFFAFA'  # 主颜色
+    bbg = '#FFFAFA'  # 按钮颜色
+    fg = '#000000'  # 文字颜色
     top["bg"] = bg
     top.title('CoTan函数工厂')
     top.resizable(width=False, height=False)
     top.geometry('+10+10')
-    FONT = ('Font\ZKST.ttf', 11)#设置字体
+    FONT = (r'Font\ZKST.ttf', 11)  # 设置字体
     rcParams['font.family'] = 'simhei'
-    rcParams['axes.unicode_minus']=False
+    rcParams['axes.unicode_minus'] = False
 
-    width_B = 13#标准宽度
-    height_B=2
+    width_B = 13  # 标准宽度
+    height_B = 2
     a_y = 0
     a_x = 1
-    global Func_Input,start_Input,end_Input,kd_Input,JD_Input,FuncName_Input,FuncView_Input
-    tkinter.Label(top, text='输入解析式:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    global Func_Input, start_Input, end_Input, kd_Input, JD_Input, FuncName_Input, FuncView_Input
+    tkinter.Label(
+        top,
+        text='输入解析式:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Func_Input = tkinter.Entry(top, width=width_B * 2)
-    Func_Input.grid(column=a_x+1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Func_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='定义域前端点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='定义域前端点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     start_Input = tkinter.Entry(top, width=width_B * 2)
-    start_Input.grid(column=a_x+1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    start_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='定义域后端点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='定义域后端点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     end_Input = tkinter.Entry(top, width=width_B * 2)
-    end_Input.grid(column=a_x+1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    end_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='函数绘制跨度:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='函数绘制跨度:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     kd_Input = tkinter.Entry(top, width=width_B * 2)
-    kd_Input.grid(column=a_x+1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    kd_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='函数计算精度:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='函数计算精度:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     JD_Input = tkinter.Entry(top, width=width_B * 2)
-    JD_Input.grid(column=a_x+1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    JD_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='函数名字:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='函数名字:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     FuncName_Input = tkinter.Entry(top, width=width_B * 2)
-    FuncName_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    FuncName_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='函数视图:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='函数视图:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     FuncView_Input = tkinter.Entry(top, width=width_B * 2)
-    FuncView_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    FuncView_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
-    global a_MR,a_start,a_end,a_kd
+    global a_MR, a_start, a_end, a_kd
 
     a_y += 1
-    tkinter.Label(top, text='常量a默认值:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='常量a默认值:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     a_MR = tkinter.Entry(top, width=width_B * 2)
-    a_MR.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    a_MR.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='常量a起点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='常量a起点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     a_start = tkinter.Entry(top, width=width_B * 2)
-    a_start.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    a_start.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='常量a终点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='常量a终点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     a_end = tkinter.Entry(top, width=width_B * 2)
-    a_end.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    a_end.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='常量a跨度:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='常量a跨度:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     a_kd = tkinter.Entry(top, width=width_B * 2)
-    a_kd.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    a_kd.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top,bg = bbg,fg = fg, text='应用函数',command=Add_HS, font=FONT, width=width_B, height=height_B).grid(column=a_x,row=a_y,sticky=tkinter.E + tkinter.W)  # 添加函数
-    tkinter.Button(top,bg = bbg,fg = fg, text='绘制图像',command = Fucn_Draw, font=FONT, width=width_B, height=height_B).grid(column=a_x+1, row=a_y,sticky=tkinter.E + tkinter.W)
-    tkinter.Button(top,bg = bbg,fg = fg, text='性质预测', command = Fucn_XZ,font=FONT, width=width_B, height=height_B).grid(column=a_x+2, row=a_y,sticky=tkinter.E + tkinter.W)  # 添加函数
-
-    global XZ_BOX,XZ_JD
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='应用函数',
+        command=Add_HS,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)  # 添加函数
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='绘制图像',
+        command=Fucn_Draw,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        1,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='性质预测',
+        command=Fucn_XZ,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        2,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)  # 添加函数
+
+    global XZ_BOX, XZ_JD
 
     a_y += 1
-    tkinter.Label(top, text='预测精度:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='预测精度:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     XZ_JD = tkinter.Entry(top, width=width_B * 2)
-    XZ_JD.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    XZ_JD.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
     # 显示函数的xy
     XZ_BOX = tkinter.Listbox(top, width=width_B * 3)  # 暂时不启用多选
-    XZ_BOX.grid(column=a_x, row=a_y, columnspan=3, rowspan=9, sticky=tkinter.S + tkinter.N + tkinter.E + tkinter.W)
+    XZ_BOX.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=9,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_x += 3
-    tkinter.Label(top, text='',bg = bg,fg = fg, font=FONT, width=1).grid(column=a_x, row=0)  # 设置说明
-
-
-    #第二排的开始
-    global XZ_Input,XZstart_Input,XZend_Input,XZkd_Input,YZ_Input,YZstart_Input,YZend_Input,YZkd_Input
-    global Xlimstart_Input,Xlimend_Input,Ylimstart_Input,Ylimend_Input
+    tkinter.Label(
+        top,
+        text='',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=1).grid(
+        column=a_x,
+        row=0)  # 设置说明
+
+    # 第二排的开始
+    global XZ_Input, XZstart_Input, XZend_Input, XZkd_Input, YZ_Input, YZstart_Input, YZend_Input, YZkd_Input
+    global Xlimstart_Input, Xlimend_Input, Ylimstart_Input, Ylimend_Input
     a_x += 1
     a_y = 0
-    tkinter.Label(top, text='X轴刻度声明:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴刻度声明:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     XZ_Input = tkinter.Entry(top, width=width_B * 2)
-    XZ_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    XZ_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='X轴刻度起点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴刻度起点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     XZstart_Input = tkinter.Entry(top, width=width_B * 2)
-    XZstart_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    XZstart_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='X轴刻度终点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴刻度终点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     XZend_Input = tkinter.Entry(top, width=width_B * 2)
-    XZend_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    XZend_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='X轴刻度间隔:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴刻度间隔:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     XZkd_Input = tkinter.Entry(top, width=width_B * 2)
-    XZkd_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    XZkd_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴刻度声明:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴刻度声明:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     YZ_Input = tkinter.Entry(top, width=width_B * 2)
-    YZ_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    YZ_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴刻度起点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴刻度起点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     YZstart_Input = tkinter.Entry(top, width=width_B * 2)
-    YZstart_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    YZstart_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴刻度终点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴刻度终点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     YZend_Input = tkinter.Entry(top, width=width_B * 2)
-    YZend_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    YZend_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴刻度间隔:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴刻度间隔:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     YZkd_Input = tkinter.Entry(top, width=width_B * 2)
-    YZkd_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    YZkd_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='X轴显示起点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴显示起点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Xlimstart_Input = tkinter.Entry(top, width=width_B * 2)
-    Xlimstart_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Xlimstart_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='X轴显示终点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='X轴显示终点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Xlimend_Input = tkinter.Entry(top, width=width_B * 2)
-    Xlimend_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Xlimend_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴显示起点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴显示起点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Ylimstart_Input = tkinter.Entry(top, width=width_B * 2)
-    Ylimstart_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Ylimstart_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='Y轴显示终点:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='Y轴显示终点:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Ylimend_Input = tkinter.Entry(top, width=width_B * 2)
-    Ylimend_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Ylimend_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     global ZL_Input
     a_y += 1
-    tkinter.Label(top, text='帧率(帧/ms):', bg=bg, fg=fg, font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                                     row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='帧率(帧/ms):',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     ZL_Input = tkinter.Entry(top, width=width_B * 2)
-    ZL_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
-
-    global Point_Draw,Best_Draw,Test_Draw
+    ZL_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    global Point_Draw, Best_Draw, Test_Draw
     a_y += 1
     Point_Draw = tkinter.IntVar()
     Best_Draw = tkinter.IntVar()
     Test_Draw = tkinter.IntVar()
 
-    tkinter.Checkbutton(top,bg = bg,fg = fg,activebackground=bg,activeforeground=fg,selectcolor=bg, text="显示记忆点", variable=Point_Draw).grid(column=a_x, row=a_y,
-                                                                                      sticky=tkinter.E + tkinter.W)
-    tkinter.Checkbutton(top,bg = bg,fg = fg,activebackground=bg,activeforeground=fg,selectcolor=bg, text="显示最值", variable=Best_Draw).grid(column=a_x+1, row=a_y,
-                                                                                        sticky=tkinter.E + tkinter.W)
-    tkinter.Checkbutton(top,bg = bg,fg = fg,activebackground=bg,activeforeground=fg,selectcolor=bg, text="显示文字", variable=Test_Draw).grid(column=a_x+2, row=a_y,
-                                                                                        sticky=tkinter.E + tkinter.W)
-
-    global News_BOX,Draw_BOX
+    tkinter.Checkbutton(
+        top,
+        bg=bg,
+        fg=fg,
+        activebackground=bg,
+        activeforeground=fg,
+        selectcolor=bg,
+        text="显示记忆点",
+        variable=Point_Draw).grid(
+        column=a_x,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)
+    tkinter.Checkbutton(
+        top,
+        bg=bg,
+        fg=fg,
+        activebackground=bg,
+        activeforeground=fg,
+        selectcolor=bg,
+        text="显示最值",
+        variable=Best_Draw).grid(
+        column=a_x +
+        1,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)
+    tkinter.Checkbutton(
+        top,
+        bg=bg,
+        fg=fg,
+        activebackground=bg,
+        activeforeground=fg,
+        selectcolor=bg,
+        text="显示文字",
+        variable=Test_Draw).grid(
+        column=a_x +
+        2,
+        row=a_y,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    global News_BOX, Draw_BOX
     a_y += 1
     # 显示函数的xy
-    Draw_BOX = tkinter.Listbox(top, width=width_B * 3,height=height_B*4)  # 暂时不启用多选
-    Draw_BOX.grid(column=a_x, row=a_y, columnspan=3, rowspan=3, sticky=tkinter.S + tkinter.N + tkinter.E + tkinter.W)
-    Draw_BOX.insert(tkinter.END, *['笛卡尔坐标系静态图像(默认)','矩形坐标系静态图像','笛卡尔坐标系动态图像','矩形坐标系动态图像',
-                                   '笛卡尔坐标系静态图像(无线框)','矩形坐标系静态图像(无线框)','笛卡尔坐标系动态图像(无线框)',
-                                   '矩形坐标系动态图像(无线框)','笛卡尔坐标系动态画图','矩形坐标系动态画图'])
+    Draw_BOX = tkinter.Listbox(
+        top,
+        width=width_B *
+        3,
+        height=height_B *
+        4)  # 暂时不启用多选
+    Draw_BOX.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=3,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    Draw_BOX.insert(tkinter.END,
+                    *['笛卡尔坐标系静态图像(默认)',
+                      '矩形坐标系静态图像',
+                      '笛卡尔坐标系动态图像',
+                      '矩形坐标系动态图像',
+                      '笛卡尔坐标系静态图像(无线框)',
+                      '矩形坐标系静态图像(无线框)',
+                      '笛卡尔坐标系动态图像(无线框)',
+                      '矩形坐标系动态图像(无线框)',
+                      '笛卡尔坐标系动态画图',
+                      '矩形坐标系动态画图'])
     a_y += 3
     # 显示函数的xy
-    News_BOX = tkinter.Listbox(top, width=width_B * 3,height=height_B*2)  # 暂时不启用多选
-    News_BOX.grid(column=a_x, row=a_y, columnspan=3, rowspan=2, sticky=tkinter.S + tkinter.N + tkinter.E + tkinter.W)
+    News_BOX = tkinter.Listbox(
+        top,
+        width=width_B *
+        3,
+        height=height_B *
+        2)  # 暂时不启用多选
+    News_BOX.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=2,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_x += 3
-    tkinter.Label(top, text='',bg = bg,fg = fg, font=FONT, width=1).grid(column=a_x, row=0)  # 设置说明
-
-    global Ycul_Input,Xcul_Input,Xcul_CS,Xcul_TD_Input,Xcul_TD_CS,R_cul
+    tkinter.Label(
+        top,
+        text='',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=1).grid(
+        column=a_x,
+        row=0)  # 设置说明
+
+    global Ycul_Input, Xcul_Input, Xcul_CS, Xcul_TD_Input, Xcul_TD_CS, R_cul
     a_x += 1
     a_y = 0
-    tkinter.Label(top, text='计算(y):',bg = bg,fg = fg,font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='计算(y):',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Ycul_Input = tkinter.Entry(top, width=width_B * 2)
-    Ycul_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Ycul_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='二分法计算(x):',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='二分法计算(x):',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Xcul_Input = tkinter.Entry(top, width=width_B * 2)
-    Xcul_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
-
-    Xcul_CS = []#二分法参数输入
-    name_List = ['最大迭代数','计算精度','最值允许偏移量','零点最小间隔','减少计算','允许梯度计算','最大扩张深度','扩张限制','扩张偏移量','开启二级验证','二级验证程度']
+    Xcul_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    Xcul_CS = []  # 二分法参数输入
+    name_List = [
+        '最大迭代数',
+        '计算精度',
+        '最值允许偏移量',
+        '零点最小间隔',
+        '减少计算',
+        '允许梯度计算',
+        '最大扩张深度',
+        '扩张限制',
+        '扩张偏移量',
+        '开启二级验证',
+        '二级验证程度']
     for i in range(11):
         a_y += 1
         Xcul_CS.append(tkinter.StringVar())
-        tkinter.Label(top,bg = bg,fg = fg, text=name_List[i]+':', font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                             row=a_y)  # 设置说明
-        tkinter.Entry(top, width=width_B * 2,textvariable=Xcul_CS[-1]).grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+        tkinter.Label(
+            top,
+            bg=bg,
+            fg=fg,
+            text=name_List[i] + ':',
+            font=FONT,
+            width=width_B,
+            height=height_B).grid(
+            column=a_x,
+            row=a_y)  # 设置说明
+        tkinter.Entry(top,
+                      width=width_B * 2,
+                      textvariable=Xcul_CS[-1]).grid(column=a_x + 1,
+                                                     row=a_y,
+                                                     columnspan=2,
+                                                     sticky=tkinter.E + tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='梯度法计算(x):',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='梯度法计算(x):',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Xcul_TD_Input = tkinter.Entry(top, width=width_B * 2)
-    Xcul_TD_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
-
-    Xcul_TD_CS = []#梯度法法参数输入
-    name_List = ['梯度起点','梯度终点','计算深度','计算精度']
+    Xcul_TD_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
+
+    Xcul_TD_CS = []  # 梯度法法参数输入
+    name_List = ['梯度起点', '梯度终点', '计算深度', '计算精度']
     for i in range(4):
         a_y += 1
         Xcul_TD_CS.append(tkinter.StringVar())
-        tkinter.Label(top,bg = bg,fg = fg, text=name_List[i]+':', font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                             row=a_y)  # 设置说明
-        tkinter.Entry(top, width=width_B * 2,textvariable=Xcul_TD_CS[-1]).grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+        tkinter.Label(
+            top,
+            bg=bg,
+            fg=fg,
+            text=name_List[i] + ':',
+            font=FONT,
+            width=width_B,
+            height=height_B).grid(
+            column=a_x,
+            row=a_y)  # 设置说明
+        tkinter.Entry(top,
+                      width=width_B * 2,
+                      textvariable=Xcul_TD_CS[-1]).grid(column=a_x + 1,
+                                                        row=a_y,
+                                                        columnspan=2,
+                                                        sticky=tkinter.E + tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='',bg = bg,fg = fg,height=1).grid(column=1, row=a_y)  #底部
+    tkinter.Label(
+        top,
+        text='',
+        bg=bg,
+        fg=fg,
+        height=1).grid(
+        column=1,
+        row=a_y)  # 底部
 
     a_x += 3
-    tkinter.Label(top, text='',bg = bg,fg = fg, font=FONT, width=1).grid(column=a_x, row=0)  # 设置说明
-
-    global Xcul_DS_Input,DScul_Input,DScul_JD_Input
+    tkinter.Label(
+        top,
+        text='',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=1).grid(
+        column=a_x,
+        row=0)  # 设置说明
+
+    global Xcul_DS_Input, DScul_Input, DScul_JD_Input
 
     a_x += 1
     a_y = 0
 
-    tkinter.Label(top, text='代数法计算(x):', bg=bg, fg=fg, font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                                       row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='代数法计算(x):',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     Xcul_DS_Input = tkinter.Entry(top, width=width_B * 2)
-    Xcul_DS_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    Xcul_DS_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='求(x)导数:', bg=bg, fg=fg, font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                                       row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='求(x)导数:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     DScul_Input = tkinter.Entry(top, width=width_B * 2)
-    DScul_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    DScul_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Label(top, text='逼近求导精度:', bg=bg, fg=fg, font=FONT, width=width_B, height=height_B).grid(column=a_x,
-                                                                                                     row=a_y)  # 设置说明
+    tkinter.Label(
+        top,
+        text='逼近求导精度:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
     DScul_JD_Input = tkinter.Entry(top, width=width_B * 2)
-    DScul_JD_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    DScul_JD_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top,bg = bbg,fg = fg, text='计算(y)',command = Cul_Y, font=FONT, width=width_B, height=height_B).grid(column=a_x,row=a_y)  # 设置说明
-    tkinter.Button(top,bg = bbg,fg = fg, text='二分法计算(x)',command = Cul_X, font=FONT, width=width_B, height=height_B).grid(column=a_x+1,row=a_y)
-    tkinter.Button(top,bg = bbg,fg = fg, text='梯度法计算(x)',command = Cul_X_TD, font=FONT, width=width_B, height=height_B).grid(column=a_x+2,row=a_y)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='计算(y)',
+        command=Cul_Y,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y)  # 设置说明
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='二分法计算(x)',
+        command=Cul_X,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x + 1,
+        row=a_y)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='梯度法计算(x)',
+        command=Cul_X_TD,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x + 2,
+        row=a_y)
 
     a_y += 1
-    tkinter.Button(top,bg = bbg,fg = fg,text='代数法计算',command=Cul_X_Sympy,font=FONT,width=width_B,height=height_B).grid(column = a_x,row = a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(top,bg = bbg,fg = fg, text='逼近法导数计算',command=Cul_DS_BJ, font=FONT, width=width_B,height=height_B).grid(column=a_x+1,row=a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(top,bg = bbg,fg = fg,text='导数计算',command=Cul_DS,font=FONT,width=width_B,height=height_B).grid(column =a_x+2,row = a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='代数法计算',
+        command=Cul_X_Sympy,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='逼近法导数计算',
+        command=Cul_DS_BJ,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        1,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='导数计算',
+        command=Cul_DS,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        2,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_y += 1
     k = 5
-    R_cul = tkinter.Listbox(top,height=height_B*(k-1))  # 暂时不启用多选
-    R_cul.grid(column=a_x, row=a_y, columnspan=3,rowspan = k,sticky=tkinter.N + tkinter.E + tkinter.W)
-
-    global YC_Input,YC_BOX
-    a_y += k-1
-    tkinter.Label(top, text='性质预测值:',bg = bg,fg = fg, font=FONT, width=width_B, height=height_B).grid(column=a_x, row=a_y, sticky=tkinter.N + tkinter.S)  # 设置说明
+    R_cul = tkinter.Listbox(top, height=height_B * (k - 1))  # 暂时不启用多选
+    R_cul.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=k,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+
+    global YC_Input, YC_BOX
+    a_y += k - 1
+    tkinter.Label(
+        top,
+        text='性质预测值:',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.S)  # 设置说明
     YC_Input = tkinter.Entry(top, width=width_B * 2)
-    YC_Input.grid(column=a_x + 1, row=a_y, columnspan=2, sticky=tkinter.E + tkinter.W)
+    YC_Input.grid(
+        column=a_x +
+        1,
+        row=a_y,
+        columnspan=2,
+        sticky=tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top,bg = bbg,fg = fg,text='周期性',command = Check_Periodic,font=FONT,width=width_B,height=height_B).grid(column = a_x,row = a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(top,bg = bbg,fg = fg, text='对称轴',command = Check_Symmetry_axis, font=FONT, width=width_B,height=height_B).grid(column=a_x+1,row=a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(top,bg = bbg,fg = fg,text='对称中心',command = Check_Center_of_symmetry,font=FONT,width=width_B,height=height_B).grid(column =a_x+2,row = a_y,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='周期性',
+        command=Check_Periodic,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='对称轴',
+        command=Check_Symmetry_axis,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        1,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='对称中心',
+        command=Check_Center_of_symmetry,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x +
+        2,
+        row=a_y,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_y += 1
-    tkinter.Button(top,bg = bbg,fg = fg,text='单调性',command = Check_Monotonic,font=FONT,width=width_B,height=height_B).grid(column =a_x,row = a_y, columnspan=3,sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='单调性',
+        command=Check_Monotonic,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_y += 1
     # 显示函数的xy
-    YC_BOX = tkinter.Listbox(top, width=width_B*3,height=height_B*5)  # 暂时不启用多选
-    YC_BOX.grid(column=a_x, row=a_y, columnspan=3, rowspan=6, sticky=tkinter.S + tkinter.N + tkinter.E + tkinter.W)
+    YC_BOX = tkinter.Listbox(
+        top,
+        width=width_B *
+        3,
+        height=height_B *
+        5)  # 暂时不启用多选
+    YC_BOX.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=6,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     a_x += 3
-    tkinter.Label(top, text='',bg = bg,fg = fg, font=FONT, width=1).grid(column=a_x, row=0)  # 设置说明
+    tkinter.Label(
+        top,
+        text='',
+        bg=bg,
+        fg=fg,
+        font=FONT,
+        width=1).grid(
+        column=a_x,
+        row=0)  # 设置说明
 
     a_x += 1
     a_y = 0
-    tkinter.Button(top,bg = bbg,fg = fg,text='生成表格',command=Fucn_Numpy,font=FONT,width=width_B*2,height=height_B).grid(column = a_x,row = a_y,columnspan=2)
-    tkinter.Button(top,bg = bbg,fg = fg,text='导出表格',command=Fucn_Save,font=FONT,width=width_B,height=height_B).grid(column = a_x+2,row = a_y)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='生成表格',
+        command=Fucn_Numpy,
+        font=FONT,
+        width=width_B * 2,
+        height=height_B).grid(
+        column=a_x,
+        row=a_y,
+        columnspan=2)
+    tkinter.Button(
+        top,
+        bg=bbg,
+        fg=fg,
+        text='导出表格',
+        command=Fucn_Save,
+        font=FONT,
+        width=width_B,
+        height=height_B).grid(
+        column=a_x + 2,
+        row=a_y)
 
     global Pr_BOX
     a_y += 1
-    #显示函数的xy
-    Pr_BOX=tkinter.Listbox(top,width=width_B*3)#暂时不启用多选
-    Pr_BOX.grid(column = a_x,row = a_y,columnspan = 3,rowspan =17,sticky = tkinter.S+tkinter.N+tkinter.E+tkinter.W)
+    # 显示函数的xy
+    Pr_BOX = tkinter.Listbox(top, width=width_B * 3)  # 暂时不启用多选
+    Pr_BOX.grid(
+        column=a_x,
+        row=a_y,
+        columnspan=3,
+        rowspan=17,
+        sticky=tkinter.S +
+        tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     addNews('加载完毕')
-    tkinter.mainloop()
+    tkinter.mainloop()

+ 325 - 44
Hello.py

@@ -1,72 +1,88 @@
 from multiprocessing import Process
 
+
 def painting_board():
     from CGB import draw_main
     draw_main()
 
+
 def Draw():
-    global top,HTB
+    global top, HTB
     HTB = Process(target=painting_board)
     HTB.start()
 
+
 def Data_Science():
     from Data_Science import machine_learning
     machine_learning()
 
+
 def SJKX():
-    global top,SJ
+    global top, SJ
     SJ = Process(target=Data_Science)
     SJ.start()
 
+
 def Function_mapping():
     from HSCH import Func_Control
     Func_Control()
 
+
 def Hsch():
-    global top,CH
+    global top, CH
     CH = Process(target=Function_mapping)
     CH.start()
 
+
 def Function_factory():
     from HSCH import Advanced_Control
     Advanced_Control()
 
+
 def HSGC():
-    global top,HsGC
+    global top, HsGC
     HsGC = Process(target=Function_factory)
     HsGC.start()
 
+
 def Algebraic_factory():
     from DSGC import algebraic_factory_main
     algebraic_factory_main()
 
+
 def Dsgc():
-    global top,DsGC
+    global top, DsGC
     DsGC = Process(target=Algebraic_factory)
     DsGC.start()
 
+
 def Machine_Learning():
     from Machine_learning_analysis import Main
     Main()
 
+
 def MLA():
     global top, Mla
     Mla = Process(target=Machine_Learning)
     Mla.start()
 
+
 def Git_Ctrl():
     from Git_controller import git_main
     git_main()
 
+
 def GIT_Ctrl():
     global top, Git_Ctrl
     Git = Process(target=Git_Ctrl)
     Git.start()
 
+
 def Crawler_Main():
     from Crawler import Main
     Main()
 
+
 def Crawlef_Run():
     global top, crawlef
     crawlef = Process(target=Crawler_Main)
@@ -80,7 +96,7 @@ def Main():
     from PIL import ImageTk, Image
     from New_TK import DragWindow
     print('加载完毕')
-    top = DragWindow(alpha=0.97,width=1200,height=800)
+    top = DragWindow(alpha=0.97, width=1200, height=800)
     ft = tkFont.Font(family='Comic Sans MS', size=20, weight=tkFont.BOLD)
     ft1 = tkFont.Font(family='Comic Sans MS', size=16, weight=tkFont.BOLD)
     ft2 = tkFont.Font(family='Comic Sans MS', size=10)
@@ -89,55 +105,320 @@ def Main():
     top.resizable(width=False, height=False)
     top.geometry(f'1200x800+30+30')
 
-    #渲染白色
+    # 渲染白色
     F1 = tkinter.Frame(top, width=1200, height=800, bg='#FFFFFF')
     F1.pack()
 
-    #图片
-    canvas = tkinter.Canvas(F1,bd=0, width=1000, height=800,highlightthickness=0)
+    # 图片
+    canvas = tkinter.Canvas(
+        F1,
+        bd=0,
+        width=1000,
+        height=800,
+        highlightthickness=0)
     photo = ImageTk.PhotoImage(Image.open('Pic/Night2.jpg'))
     canvas.create_image(500, 400, image=photo)
-    canvas.grid(column=1, row=0,sticky=tkinter.S + tkinter.N,rowspan =20)
+    canvas.grid(column=1, row=0, sticky=tkinter.S + tkinter.N, rowspan=20)
     abg = '#F0FFFF'
     bg = '#FFFFFF'
     bc = 'tcross'
-    #标题
-    tkinter.Label(F1, text='CoTan~科学计算', width=20,bg='#FFFFFF', font=ft).grid(column=0, row=0,sticky=tkinter.N)  # 设置说明
-    tkinter.Label(F1, text='寄忆学术',bg=abg,font=ft1).grid(column=0, row=1,sticky=tkinter.W + tkinter.E)
-    tkinter.Button(F1,text='我的寄忆',cursor=bc,height=2,font=ft2,bg=bg,activebackground=abg,bd=0,justify=tkinter.LEFT).grid(column =0,row = 2,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='寄忆草稿版',cursor=bc,command=Draw, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=3,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='自动化网页',cursor=bc,command=Crawlef_Run, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=4,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='Git仓库控制器',cursor=bc,command=GIT_Ctrl, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=5,sticky=tkinter.N + tkinter.E + tkinter.W)
+    # 标题
+    tkinter.Label(
+        F1,
+        text='CoTan~科学计算',
+        width=20,
+        bg='#FFFFFF',
+        font=ft).grid(
+        column=0,
+        row=0,
+        sticky=tkinter.N)  # 设置说明
+    tkinter.Label(
+        F1,
+        text='寄忆学术',
+        bg=abg,
+        font=ft1).grid(
+        column=0,
+        row=1,
+        sticky=tkinter.W +
+        tkinter.E)
+    tkinter.Button(
+        F1,
+        text='我的寄忆',
+        cursor=bc,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=2,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='寄忆草稿版',
+        cursor=bc,
+        command=Draw,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=3,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='自动化网页',
+        cursor=bc,
+        command=Crawlef_Run,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=4,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='Git仓库控制器',
+        cursor=bc,
+        command=GIT_Ctrl,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=5,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
 
     abg = '#FFFAFA'
-    tkinter.Label(F1, text='数学系统', bg=abg, font=ft1).grid(column=0, row=6,sticky=tkinter.W + tkinter.E)
-    tkinter.Button(F1,text='函数测绘',cursor=bc,command=Hsch,height=2,font=ft2,bg=bg,activebackground=abg,bd=0,justify=tkinter.LEFT).grid(column =0,row = 7,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='函数工厂',cursor=bc,command=HSGC, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=8,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='代数工厂',cursor=bc,command=Dsgc, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=9,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='数据科学',cursor=bc,command=SJKX, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=10,sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='机器学习',cursor=bc,command=MLA, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=11,sticky=tkinter.N + tkinter.E + tkinter.W)
-
-    abg='#F5FFFA'
-    tkinter.Label(F1, text='物化系统', bg=abg, font=ft1).grid(column=0, row=12, sticky=tkinter.W + tkinter.E)
-    tkinter.Button(F1, text='几何车间',cursor=bc, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=13,
-                                                                                                       sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='物理车间',cursor=bc, height=2, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=14,
-                                                                                                       sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='化学车间',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0,
-                                                                                                           row=15,
-                                                                                                           sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='实验室管理',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0,
-                                                                                                       row=16,
-                                                                                                       sticky=tkinter.N + tkinter.E + tkinter.W)
+    tkinter.Label(
+        F1,
+        text='数学系统',
+        bg=abg,
+        font=ft1).grid(
+        column=0,
+        row=6,
+        sticky=tkinter.W +
+        tkinter.E)
+    tkinter.Button(
+        F1,
+        text='函数测绘',
+        cursor=bc,
+        command=Hsch,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=7,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='函数工厂',
+        cursor=bc,
+        command=HSGC,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=8,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='代数工厂',
+        cursor=bc,
+        command=Dsgc,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=9,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='数据科学',
+        cursor=bc,
+        command=SJKX,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=10,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='机器学习',
+        cursor=bc,
+        command=MLA,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=11,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+
+    abg = '#F5FFFA'
+    tkinter.Label(
+        F1,
+        text='物化系统',
+        bg=abg,
+        font=ft1).grid(
+        column=0,
+        row=12,
+        sticky=tkinter.W +
+        tkinter.E)
+    tkinter.Button(
+        F1,
+        text='几何车间',
+        cursor=bc,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=13,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='物理车间',
+        cursor=bc,
+        height=2,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=14,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='化学车间',
+        cursor=bc,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=15,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='实验室管理',
+        cursor=bc,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=16,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
     abg = '#F8F8FF'
-    tkinter.Label(F1, text='其他工具', bg=abg, font=ft1).grid(column=0, row=17, sticky=tkinter.W + tkinter.E)
-    tkinter.Button(F1, text='系统扩展',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=18,
-                                                                                                       sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Button(F1, text='Tensorflew深度学习',cursor=bc, height=1, font=ft2, bg=bg,activebackground=abg, bd=0, justify=tkinter.LEFT).grid(column=0, row=19,
-                                                                                                       sticky=tkinter.N + tkinter.E + tkinter.W)
-    tkinter.Label(F1, text='', bg='#FFFFFF', font=ft1,height=5).grid(column=0, row=20, sticky=tkinter.W + tkinter.E)
-    canvas.create_text(500,750,text='CoTan~别来无恙',font=ft3,fill='#FFFFE0')
+    tkinter.Label(
+        F1,
+        text='其他工具',
+        bg=abg,
+        font=ft1).grid(
+        column=0,
+        row=17,
+        sticky=tkinter.W +
+        tkinter.E)
+    tkinter.Button(
+        F1,
+        text='系统扩展',
+        cursor=bc,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=18,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Button(
+        F1,
+        text='Tensorflew深度学习',
+        cursor=bc,
+        height=1,
+        font=ft2,
+        bg=bg,
+        activebackground=abg,
+        bd=0,
+        justify=tkinter.LEFT).grid(
+        column=0,
+        row=19,
+        sticky=tkinter.N +
+        tkinter.E +
+        tkinter.W)
+    tkinter.Label(
+        F1,
+        text='',
+        bg='#FFFFFF',
+        font=ft1,
+        height=5).grid(
+        column=0,
+        row=20,
+        sticky=tkinter.W +
+        tkinter.E)
+    canvas.create_text(500, 750, text='CoTan~别来无恙', font=ft3, fill='#FFFFE0')
     top.mainloop()
 
+
 if __name__ == "__main__":
-    Main()
+    Main()

文件差异内容过多而无法显示
+ 407 - 263
Machine_learning_analysis/Learn_Numpy.py


文件差异内容过多而无法显示
+ 1740 - 339
Machine_learning_analysis/Machine_learning.py


+ 1 - 0
New_TK/__init__.py

@@ -1,5 +1,6 @@
 import tkinter as tk
 
+
 class DragWindow(tk.Tk):
     root_x, root_y, abs_x, abs_y = 0, 0, 0, 0
     width, height = None, None

部分文件因为文件数量过多而无法显示