from tkinter import * from tkinter import ttk from tkinter.filedialog import askopenfilename from tkinter import scrolledtext root = Tk() cb = ttk.Combobox(root) pb = ttk.Progressbar(root,length=400) t = scrolledtext.ScrolledText(root) file_name = StringVar() page_start = IntVar() page_stop = IntVar() def open_file(): _file_name = askopenfilename() file_name.set(_file_name) language = ["kor","eng","chi_sim"] def start(): my_print(file_name.get()) if file_name.get() == "": my_print("null") my_print(str(page_start.get())) my_print(str(page_stop.get())) my_print(language[cb.current()%3]) pb.step(1) def my_print(str): t.insert(END,str + "\n") t.see(END) def start_gui(): root.title("PDF OCR") Label(root,text="pdf file:").grid(row=1,sticky=W) Entry(root,textvariable = file_name,width=55).grid(row=1,column=1,columnspan=3,sticky=W) Button(root,text="open",width=10,command = open_file).grid(row=1,column=4) Label(root,text="language:").grid(row=2,sticky=W) cb.grid(row=2,column=1,sticky=W) cb["values"] = ("Korean", "English", "Chinese") cb.current(0) Label(root,text="page range:").grid(row=3,sticky=W) Entry(root,textvariable = page_start).grid(row=3,column=1,sticky=W) #page_start.set(0) Label(root,text="~").grid(row=3,column=2) Entry(root,textvariable = page_stop).grid(row=3,column=3,sticky=W) #page_stop.set(0) Label(root,text="").grid(row=4) Button(root,text="start",width=10,command = start).grid(row=5,column=2) Label(root,text="").grid(row=6) pb.grid(row=7,columnspan=5) pb["maximum"] = 100 pb["value"] = 0 Label(root,text="").grid(row=8) t.grid(row=9,column=0,columnspan=5) root.mainloop() if __name__=="__main__": print("start") start_gui()