Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter as tk
- from PIL import ImageTk, Image
- import tkinter.filedialog as filedialog
- from model_recognition import main
- def LoadFile(ev):
- global filename
- filename = filedialog.askopenfilename(initialdir="./", title="Select file",
- filetypes=(("jpeg files", "*.jpg"), ("png files", "*.png")))
- print(filename)
- def ShowImg():
- img_label = Label(root)
- img_label.image = ImageTk.PhotoImage(Image.open('./test.jpg'))
- img_label.pack()
- root = Tk()
- filename = ''
- panelFrame = Frame(root, height=60, bg='gray')
- textFrame = Frame(root, height=340, width=600)
- panelFrame.pack(side='top', fill='x')
- textFrame.pack(side='bottom', fill='both', expand=1)
- textbox = Text(textFrame, font='Arial 14', wrap='word')
- textbox.pack(side='left', fill='both', expand=1)
- loadBtn = Button(panelFrame, text='Load')
- loadBtn.bind("<Button-1>", LoadFile)
- loadBtn.place(x=10, y=10, width=40, height=40)
- #
- # showBtn = Button(panelFrame, text='Show')
- # showBtn.bind("<Button-2>", ShowImg)
- # showBtn.place(x=50, y=10, width=40, height=40)
- ShowImg()
- root.mainloop(
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement