-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Type of Issue (Enhancement, Error, Bug, Question)
Question
Operating System
Windows 11
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.12.1
PySimpleGUI Version (sg.__version__)
4.60.5
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
8.6.13
Your Experience In Months or Years (optional)
Years Python programming experience : just learning
Years Programming experience overall: 45 years
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine): no
Anything else you think would be helpful?
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- [X ] Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- [X ] None of your GUI code was generated by an AI algorithm like GPT
- [X ] If not tkinter - looked for Demo Programs for specific port
- [X ] For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- [X ] Run your program outside of your debugger (from a command line)
- [X ] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- [X ] Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- [X ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
I am wanting to write a menu driven system that opens various windows, each with a menu in them.
I have written a different python file for each window, and I start with a main menu window.
With the main menu window open, I open a second window and it the second window works fine, but I cannot use any of the buttons on the first window until the second window is closed - it seems to buffer the instructions and it only performs them after the second window is closed.
Is there something I can do so that the user can swop between the open windows and use the full functionality of the open windows?
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
from try01 import fTry01
from try02 import fTry02
# the main program
def main():
mInputMain = [
[sg.Text('This is the main window')],
[sg.Button('Open 1', key='-OPEN01-')],
[sg.Button('Open 2', key='-OPEN02-')]
]
window = sg.Window('InputMain', mInputMain, location=(20, 0), resizable=True, finalize=True)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
if event == '-OPEN01-':
fTry01()
elif event == '-OPEN02-':
fTry02()
window.close()
if __name__ == '__main__':
main()
# the code that calls a second window
import PySimpleGUI as sg
def fTry02():
mInput02 = [
[sg.Text('This is the second window that is being opened')],
[sg.Text('This will be the second line on the window')],
[sg.Input('', size=(12,1), enable_events=True, key='-INPUT02-')],
[sg.Button('Clear02', key='-CLEAR02-')]
]
window02 = sg.Window('Input02', mInput02, location=(400,400), resizable=True, finalize=True)
while True:
event, values = window02.read()
print(f'{event} was clicked')
if event == sg.WIN_CLOSED:
break
elif event == '-CLEAR02-':
print('clear02')
window02['-INPUT02-'].update('', background_color = 'red')
window02.close()Screenshot, Sketch, or Drawing
Watcha Makin?
I have written a system in Microsoft Excel (VBA) that plots the drift of an object in the sea so that we can search and find a casualty more easily. I am wanting to rewrite it so that it is independent of Microsoft, but also so that it can run cross-platform.
This is the reason that, at my ripe old age of over 70, I am learning python and wanted to use your wonderful PySimpleGUI
Regards, Marilyn
