'''该文件将用于界面的生成,以及用excl表格保存输入数据
用一个excl表格存储数据,以达到记忆功能
这个excl表格将会由程序创建,用户将有权决定他的储存数据
在用户调用历史数据时,这个程序会读取并将其表示出来'''
'''该文件将用于界面的生成,以及用excl表格保存输入数据
用一个excl表格存储数据,以达到记忆功能
这个excl表格将会由程序创建,用户将有权决定他的储存数据
在用户调用历史数据时,这个程序会读取并将其表示出来'''
# 打包用我(pyinstaller -F -w main.py --hidden-import=['openpyxl'])
import os
import time
import sys
# ----------------------------------------------------------------------------------------------------------------------
from tkinter import *
from tkinter import ttk
# ----------------------------------------------------------------------------------------------------------------------
import openpyxl
# ----------------------------------------------------------------------------------------------------------------------
import numpy as np
import pandas as pd
from sympy import *
from sympy import S, symbols, nonlinsolve, Rational, I
# ----------------------------------------------------------------------------------------------------------------------
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
# ----------------------------------------------------------------------------------------------------------------------
class analpressmecaism(Frame): # 定义显示窗口界面的类
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.welcome()
def window_destroy(self): # 该方法用与摧毁之前留下的窗口界面残留
for widget in self.winfo_children():
widget.destroy()
def wait(self):
self.label_wait = Label(self, text="请稍等······")
self.label_wait.pack()
def welcome(self): # 欢迎界面
self.label_welcome = Label(self, text="欢迎使用本机构解析发软件(*^-^*),如有使用问题请联系2564977456@qq.com")
self.label_welcome.pack()
self.button_start = Button(self, text="开始", command=self.first_use_judge)
self.button_start.pack()
self.button_quit = Button(self, text="结束", command=self.quit)
self.button_quit.pack()
def first_use_judge(self): # 该方法用于多选判断之前是否存储过界面的页面
self.window_destroy()
self.label_use_judge = Label(self, text="是否创建过存储表格")
self.label_use_judge.pack()
self.use_yes = IntVar();
self.use_no = IntVar()
print(self.use_yes.get())
self.c_use_y = Checkbutton(self, text='是', variable=self.use_yes, onvalue=1, offvalue=0)
self.c_use_n = Checkbutton(self, text='否', variable=self.use_no, onvalue=1, offvalue=0)
self.c_use_y.pack(side='left')
self.c_use_n.pack(side='left')
Button(self, text='确定', command=self.use_judge_confirm).pack(side='left')
def use_judge_confirm(self): # 该方法是对于上方self.first_use_judge()的延续,用于对其结果进行判断处理
if self.use_yes.get() == 1: # 如果说存储过的话,询问存储路径并查找判断
self.window_destroy()
self.label_use_judge = Label(self, text="请输入上次存储路径,默认工作目录")
self.label_use_judge.pack()
v_store_place = StringVar()
self.entry_store_place = Entry(self, textvariable=v_store_place)
self.entry_store_place.pack()
workplace = os.getcwd()
v_store_place.set(workplace)
print(v_store_place.get())
print(self.entry_store_place.get())
self.store_place_judgeb = Button(self, text="检查", command=self.store_place_judge)
self.store_place_judgeb.pack()
# 检查会转到下面self.store_place_judge进行判断
self.store_place_back = Button(self, text="回退上一级", command=self.first_use_judge)
self.store_place_back.pack()
if self.use_no.get() == 1: # 如果说没有存储过的话,直接跳转到新建储存文件函数
self.store_place()
def store_place(self): # 该方法用与进行进行新建存储文件操作
self.window_destroy()
self.label_store_place = Label(self, text="请选择你要存储数据的位置,默认在程序文件夹,推荐默认,其他位置可能存在后续不兼容")
self.label_store_place.pack()
v_store_place = StringVar()
self.entry_store_place = Entry(self, textvariable=v_store_place)
self.entry_store_place.pack()
workplace = os.getcwd()
v_store_place.set(workplace)
print(v_store_place.get())
print(self.entry_store_place.get())
self.store_place_judgeb = Button(self, text="创建", command=self.store_place_judge)
self.store_place_judgeb.pack()
def store_place_judge(self): # 该方法是对于存储位置是否有该文件的判断
path = self.entry_store_place.get()
self.window_destroy()
# 先得到数据,再对之前的窗口界面进行清除
excl_path = os.path.join(path, '解析法机构分析用表.xlsx')
if no