Hello,
I'm currently experimenting with my first GUI in Python (or in any other programming language) using PySimpleGUI and I'm stumbling on some issues I cannot resolve.
This is the code I've written so far:
![[Image: ezgif-3-60b97a2c9c92.jpg]](https://im3.ezgif.com/tmp/ezgif-3-60b97a2c9c92.jpg)
The "Convert" button, linked to my custom reverseComplement() function actually functions. So the general functionality of my GUI works.
However, I experience following issues:
1) when I press the button "Help", I get the correct new windows pops up. However, I cannot close this help window by pressing the "Cancel" button. Pressing Cancel, does not do anything at the moment. I can, however, close it by pressing "X" in the top right corner. Why is this? Both the Cancel and X buttons should close the window right?
I also tried the following code without succes:
Any help would be much appreciated.
I'm currently experimenting with my first GUI in Python (or in any other programming language) using PySimpleGUI and I'm stumbling on some issues I cannot resolve.
This is the code I've written so far:
Import PySimpleGUI as sg sg.theme('DarkAmber') layout = [[sg.Text('Reverse complement:'), sg.Text(size=(15,1), key='-OUTPUT-')], [sg.Input(key='-IN-')], [sg.Button('Convert'), sg.Button('Exit'), sg.Button('Help')]] layout_help = [[sg.Text("This program requires a DNA sequence as an input and returns the reverse complement")],[sg.Button("Cancel")]] window = sg.Window('Reverse Complement Converter', layout) window_help = sg.Window("Help", layout_help) while True: event, values = window.read() if event == sg.WIN_CLOSED or event == 'Exit': break if event == 'Convert': seq=values['-IN-'] rc= reverseComplement(seq) window['-OUTPUT-'].update(rc) if event == "Help": window_help.read() if event == "Cancel" or event == sg.WIN_CLOSED: window_help.close() window.close()If I run the script, the appropriate window opens:
![[Image: ezgif-3-60b97a2c9c92.jpg]](https://im3.ezgif.com/tmp/ezgif-3-60b97a2c9c92.jpg)
The "Convert" button, linked to my custom reverseComplement() function actually functions. So the general functionality of my GUI works.
However, I experience following issues:
1) when I press the button "Help", I get the correct new windows pops up. However, I cannot close this help window by pressing the "Cancel" button. Pressing Cancel, does not do anything at the moment. I can, however, close it by pressing "X" in the top right corner. Why is this? Both the Cancel and X buttons should close the window right?
I also tried the following code without succes:
if event == "Help": window_help.read() if event == "Cancel" or event == sg.WIN_CLOSED: break2) Also regarding the "Help" window: When I press "Help" and thereafter close the help window by pressing "X", nothing happens when I press te "Help" button again. Why is this? If the program stays in the event loop, it should be able to process "Help" more than once?
Any help would be much appreciated.