Type of Issue (Enhancement, Error, Bug, Question)
Can't cycle the layout with the button
Operating System
Windows 10
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version (sg.sys.version)
3.8.0
PySimpleGUI Version (sg.__version__)
4.41.2
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
Your Experience In Months or Years (optional)
1.5 Years Python programming experience
1.5 Years Programming experience overall
Have used another Python GUI Framework? (tkinter, Qt, etc) (no is fine)
Anything else you think would be helpful? i'm a beginner and I'm not a developer. I use python for statistical analysis usually but am starting a new project for the students
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
Detailed Description
Hi everyone,
I managed to perform cycle layout thanks to your help but I am stuck with a problem for a while now.
I think my last loop is not good: I would like when the user answers "E", to update the output with "good answer". Then the user has a to click on OK to go back to the first layout.
But it doesn't work: it creates an endless loop.
Why is my loop wrong?
Code To Duplicate
A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)
This pre-formatted code block is all set for you to paste in your bit of code:
import PySimpleGUI as sg
# import PySimpleGUIQt as sg
# ----------- Create the 3 layouts this Window will display -----------
layout1 = [[sg.Text('Layout 1')],
[sg.CB("A", key="A"), sg.CB("B", key="B")]]
layout2 = [[sg.Text('Layout 2')],
[sg.CB("C", key="C"), sg.CB("D", key="D")]]
layout3 = [[sg.Text('Layout 3')],
[sg.CB("E", key="E"), sg.CB("F", key="F")],
[sg.Text(key="OUTPUT")]]
# ----------- Create actual layout using Columns and a row of Buttons
layout = [[sg.Column(layout1, key='-COL1-'), sg.Column(layout2, visible=False, key='-COL2-'), sg.Column(layout3, visible=False, key='-COL3-')],
[sg.Button('OK'), sg.Button('Exit')]]
window = sg.Window('Swapping the contents of a window', layout)
layout = 1 # The currently visible layout
while True:
event, values = window.read()
print(event, values)
if event in (sg.WIN_CLOSED, 'Exit'):
break
if event == 'OK' and values["A"]==True and values["B"]==False:
window[f'-COL1-'].update(visible=False)
window[f'-COL2-'].update(visible=True)
if event=="OK" and values["C"]==True and values["D"]==False:
window[f'-COL2-'].update(visible=False)
window[f'-COL3-'].update(visible=True)
if event =="OK" and values["E"]==True and values["F"]==False:
window['OUTPUT'].update("Good answer")
if event=="OK":
window[f'-COL3-'].update(visible=False)
window[f'-COL1-'].update(visible=True)
window.close()
Screenshot, Sketch, or Drawing
Type of Issue (Enhancement, Error, Bug, Question)
Can't cycle the layout with the button
Operating System
Windows 10
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Version information can be obtained by calling
sg.main_get_debug_data()Or you can print each version shown in ()
Python version (
sg.sys.version)3.8.0
PySimpleGUI Version (
sg.__version__)4.41.2
GUI Version (tkinter (
sg.tclversion_detailed), PySide2, WxPython, Remi)Your Experience In Months or Years (optional)
1.5 Years Python programming experience
1.5 Years Programming experience overall
Have used another Python GUI Framework? (tkinter, Qt, etc) (no is fine)
Anything else you think would be helpful? i'm a beginner and I'm not a developer. I use python for statistical analysis usually but am starting a new project for the students
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
Detailed Description
Hi everyone,
I managed to perform cycle layout thanks to your help but I am stuck with a problem for a while now.
I think my last loop is not good: I would like when the user answers "E", to update the output with "good answer". Then the user has a to click on OK to go back to the first layout.
But it doesn't work: it creates an endless loop.
Why is my loop wrong?
Code To Duplicate
A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)
This pre-formatted code block is all set for you to paste in your bit of code:
Screenshot, Sketch, or Drawing