Skip to content

Commit

Permalink
Merge pull request #2 from mekitoci/main
Browse files Browse the repository at this point in the history
New Function: Add Refresh Button
  • Loading branch information
mekitoci authored Jun 1, 2022
2 parents 8ee8450 + 72be26a commit 8847d9a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ThesisFormatChecker/thesisCheck.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# coding = utf-8
import PyPDF2,os
import os
import pandas as pd
import pdfplumber
import re
import tkinter as tk
from tkinter import ttk,filedialog

def romanToInt(inputRoman):
sum = 0
Expand All @@ -30,7 +29,7 @@ def readContext( pdfReader ):
pN = pdfReader.pages[i]
text= pN.extract_text()
contextWithoutCover.append(text)
pdfReader.close()
return contextWithoutCover

def ContentCheck(contextWithoutC,yourContentPageS,yourContentPageE,yourContextStart,fileName):
Expand Down Expand Up @@ -118,13 +117,15 @@ def ContentCheck(contextWithoutC,yourContentPageS,yourContentPageE,yourContextSt
report = pd.DataFrame((zip(uncorrectList, uncorrectPageNum)), columns = ['Title', 'pageNum'])
report.to_csv(fileName+"report.csv",encoding = "utf_8_sig")


open_button = tk.Button(
window,
text='查看結果',
command=open_file)
open_button.pack(pady=20)

btn_refresh = tk.Button(window , text="refresh" ,command=refresh)
btn_refresh.pack(pady=20)

return checkBool

def main():
Expand All @@ -142,9 +143,17 @@ def main():

correctOrNot=ContentCheck(contextWithoutC,yourContentPageS,yourContentPageE,yourContextStart,str(studentId.get("1.0","end").strip()))
print(correctOrNot)
pdfReader.close()
except:
print("something Error")

def refresh():
studentId.delete("1.0", "end")
ContentStart.delete("1.0", "end")
ContentEnd.delete("1.0", "end")
ThesisStart.delete("1.0", "end")
os.chdir('../')

def open_file():
os.system("start EXCEL.EXE " + str(studentId.get("1.0","end").strip()) +"report.csv")

Expand Down Expand Up @@ -179,5 +188,4 @@ def open_file():
stateBar.pack(pady=5)

window.mainloop()


0 comments on commit 8847d9a

Please sign in to comment.