0

I want to compare two images using CANNY and FLANN framework. My image comparison code is ready but I want my result in the console or space in the same window of user input in below code of pysimplegui.

import PySimpleGUI as sg

sg.theme('Light Blue 2')

layout = [[sg.Text('Enter 2 files to comare')],
          [sg.Text('File 1', size=(8, 1)), sg.Input(), sg.FileBrowse()],
          [sg.Text('File 2', size=(8, 1)), sg.Input(), sg.FileBrowse()],
          [sg.Submit(), sg.Cancel()]]

window = sg.Window('File Compare', layout)

event, values = window.read()
window.close()

enter image description here

Amaze_Rock
  • 163
  • 3
  • 16

1 Answers1

-1

If you're needing to display the result of the compare code, you should be able to just declare a variable that is equal to the result and print the variable like this:

my_variable = results
print(my_variable)

If you're needing to display the result in the same window as your user input, you'll need to use sg.Output() within one of the rows to create a box that will show everything that you would tell python to print in the console. For my example, I'd make the fourth row of your layout:

[sg.Submit(), sg.Cancel(), sg.Output(size=4,1)]]

which will display an ouput box to the right of your Cancel button.

Josh Bunner
  • 37
  • 1
  • 9