0

I'm working with plots and I want to call a PySimpleGUI window on a press of a TK button which will show my plot tuples and allow modifying them to later re-draw the plot. So far I took this cookbook example and added a save button:

layout += [[sg.Button('Save')]]

This is how I call it:

def readWindow(event):
    values = window.read()
    print(values)
editButton.on_clicked(readWindow)

and it successfully passes values when I click "save". But if I close the window and try to open it again, I get (None, None) in the console.

psykana
  • 104
  • 1
  • 10

1 Answers1

1

You don't need tkinter Button.

import PySimpleGUI as sg

# layout = ...
layout += [[sg.Button("Save", ...]]

window = sg.Window("Title", layout)

while True:

    event, values = window.read()
    if event == sg.WINDOW_CLOSED:
        break
    elif event == "Save":
        print(event, values)

window.close()   
Jason Yang
  • 11,284
  • 2
  • 9
  • 23