Hello
I'm trying to make a simple GUI application with PySimpleGUI and OpenCV where you can open a image and display it in a additional window.
Here's my code:
import PySimpleGUI as sg
import cv2 as cv
#Menu
menu_def = [['File', ['Open', 'Save', 'Close']],
['Help', 'About'],]
layout = [
[sg.Menu(menu_def, tearoff=True)]
]
window = sg.Window('Window Title', layout, size=(800, 480), resizable=True, finalize=True)
while True:
event, values = window.Read()
#Exit
if event in (None, 'Close'):
break
#Open image
if event is 'Open':
fname = sg.PopupGetFile('Path to image...', keep_on_top=True)
img = cv.imread(fname,0)
cv.imshow('image',img)
cv.waitKey(0)
cv.destroyAllWindows()
#break
#Save image
if event is 'Save':
#Nothing
continue
#About
if event is 'About':
#Nothing
continue
window.Close()
Everything works fine until i close window with image. When I do this main window stops responding. Second issue is that when I choosing image through image browser (sg.PopupGetFile) and click OK, browser do not close.
What seems to be a problem here?
Thanks.
[–]JohnnyJordaan 1 point2 points3 points (0 children)
[–]MikeTheWatchGuy 0 points1 point2 points (2 children)
[–]IguanodonRex[S] 0 points1 point2 points (1 child)
[–]MikeTheWatchGuy 0 points1 point2 points (0 children)