我正在尝试构建手写文本识别系统,在该系统中,我要允许用户打开任何手写文本图像,然后对其进行预处理,在识别和转换后,我想在该预处理图像旁边打印结果(文本)。 / p>
我试图将两个框架彼此相邻,但无法正常工作。所以我需要如何做以及如何在Frame中打开图像的帮助。
from tkinter import *
import tkinter.filedialog as filedailog
root = Tk()
global tt
def oif():
global xf
tt.delete(1.0 , END)
root.title("")
xf = filedailog.askopenfilename()
root.title(xf)
tt.insert(END , open(xf).read())
def prp():
sv = tt.get(1.0, END)
f = open(xf, 'wt')
f.write(sv)
f.close()
def convert():
pass
open_image = Button(root , text="Open Image" ,width = 16 , command = oif )
open_image.grid(row=0 , column = 0)
preprocess =Button(root , text = "PreProcess" , width = 16 , command = prp)
preprocess.grid(row = 0 , column = 1)
Convert =Button(root , text = "Convert" , width = 16 , command = convert)
Convert.grid(row = 0 , column = 2)
image_frame = Frame(root , width=40 , height = 20)
image_frame.grid(row = 1 , column = 0)
text_frame = Frame(root , width=40 , height = 20)
image_frame.grid(row = 1 , column = 1)
tt = Text(text_frame , state='normal' , height = 20 , width = 80)
tt.pack()
root.mainloop()