54 lines
2.0 KiB
Python
54 lines
2.0 KiB
Python
import tkinter as tk
|
||
from tkinter import filedialog
|
||
import algam
|
||
import save
|
||
|
||
|
||
#def Pars():
|
||
# if algam.isint(enumer.get()):
|
||
# algam.split_file(input_file=excel_entry1.get(), chunk_size=int(enumer.get()),output_dir=directory_entry.get())
|
||
# else:
|
||
# excel_label4 = tk.Label(root, text="должны быть только целочисленные цисла от 20 до 500", font=font)
|
||
# excel_label4.pack(anchor="w")
|
||
|
||
def Pars():
|
||
data = algam.ReadMifDirectory().find_mif_files(directory=directory_entry.get())
|
||
|
||
save.SaveDataXLSX(file_path=file_to_save_entry.get(),sheet_name="Лист1",data=data)
|
||
|
||
root = tk.Tk()
|
||
root.title("Parser11(отяет по mif)")
|
||
font = ("Arial", 12)
|
||
root.configure(bg="#B85C38")
|
||
options = [""]
|
||
|
||
#путь для сохранения файлов
|
||
def open_directory(event, entry):
|
||
directory_path = filedialog.askdirectory()
|
||
entry.delete(0, tk.END)
|
||
entry.insert(0, directory_path)
|
||
|
||
# первое поле с списком
|
||
def open_excel_file(event, entry):
|
||
excel_path = filedialog.askopenfilename(filetypes=(("Excel files", "*.xlsx"), ("All files", "*.*")))
|
||
entry.delete(0, tk.END)
|
||
entry.insert(0, excel_path)
|
||
|
||
# первое поле с списком
|
||
file_to_save_label = tk.Label(root, text="файл_для_сохранения", font=font)
|
||
file_to_save_label.pack(anchor="w")
|
||
file_to_save_entry = tk.Entry(root, font=font, width=70)
|
||
file_to_save_entry.pack(anchor="w")
|
||
file_to_save_entry.bind("<Button-1>", lambda event: open_excel_file(event, file_to_save_entry))
|
||
|
||
directory_label = tk.Label(root, text="Выберите директорию c mif:", font=font)
|
||
directory_label.pack(anchor="w")
|
||
directory_entry = tk.Entry(root, font=font, width=70)
|
||
directory_entry.pack(anchor="w")
|
||
directory_entry.bind("<Button-1>", lambda event: open_directory(event, directory_entry))
|
||
|
||
# кнопка
|
||
empty_button = tk.Button(root, text="->", command=Pars, font=font)
|
||
empty_button.pack(side="right", padx=10, pady=10)
|
||
|
||
root.mainloop() |