Enhancement - Demo Program
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza con Demo_Multiple_Windows_read_all_windows_25_lines.py y ejecuta el ejemplo proporcionado de dos ventanas con el port de tkinter. Reproduce el error de la aplicación cerrando una ventana mientras no está pausada y, a continuación, compara el comportamiento con la corrección indicada. La tarea estará terminada cuando cerrar ventanas ya no provoque el error de la aplicación y el bucle de eventos de la demo siga terminando correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Type of Issue (Enhancement, Error, Bug, Question)
Enhancement
Operating System
Wndows 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 Interpeter: C:\Users\AndyJ\AppData\Local\Programs\Python\Python311\python.exe
Python version: 3.11.1
Platform: Windows
Platform version: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Port: PySimpleGUI
tkinter version: 8.6.12
PySimpleGUI version: 4.60.4.145
PySimpleGUI filename: C:\Users\AndyJ\AppData\Local\Programs\Python\Python311\Lib\site-packages\PySimpleGUI\PySimpleGUI.py
Your Experience In Months or Years (optional)
Years Python programming experience
2 years
Years Programming experience overall
30 years
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
Anything else you think would be helpful?
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [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
- If not tkinter - looked for Demo Programs for specific port
- For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- Run your program outside of your debugger (from a command line)
- Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
demo program - Demo_Multiple_Windows_read_all_windows_25_lines.py - causes application error if a windows is closed when its not paused.
I have worked out a fix - pasted below.
I am not sure if thats the best way to do it, but it works as far as I can see
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:
# Paste your code here
#!/usr/bin/env python
"""
Demo - Multiple read_all_window(timeout=20)
A 2-window event loop run in async mode
Super-simple, 25 lines of code.
Copyright 2021 PySimpleGUI
"""
import PySimpleGUI as sg
sg.set_options(font='_ 18')
window1 = sg.Window('ONE', [[sg.T('Window 1',size=(30,1),k='-T-')],[sg.B('Run', k='-B-'), sg.B('Exit')]],
finalize=True,
metadata="Open")
window2 = sg.Window('TWO', [[sg.T('Window 2',k='-T-')],[sg.B('Run', k='-B-'),sg.B('Exit')]], finalize=True,
location=(window1.current_location()[0]-250,window1.current_location()[1]),
metadata="Open")
i, paused = 0, [False, False]
while True: # Event Loop
window, event, values = sg.read_all_windows(timeout=10)
print(window, event, values) if event != sg.TIMEOUT_EVENT else None
if window == sg.WIN_CLOSED and event == sg.WIN_CLOSED:
window1.close()
window2.close()
sg.popup_auto_close('Exiting...')
break
if event in (sg.WINDOW_CLOSED, 'Exit'):
window.metadata = 'Closed"'
window.close()
continue
if (not paused[0]) and window1.metadata == 'Open':
window1['-T-'].update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
if (not paused[1]) and window2.metadata == 'Open':
window2['-T-'].update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
if event == '-B-':
paused[0 if window == window1 else 1] = not paused[0 if window == window1 else 1]
window['-B-'].update('Run' if not paused[0 if window == window1 else 1] else 'Pause')
i += 1
Screenshot, Sketch, or Drawing

Watcha Makin?
If you care to share something about your project, it would be awesome to hear what you're building.
- Lenguaje dominante
- Python
- Estrellas
- 13.8k
- Forks
- 1.8k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PySimpleGUI/PySimpleGUI
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 comentarios ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 comentario ·
-
Done - Install Dev Build (see docs for how) enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 comentario · 1 reacción ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 comentario ·
Todos los issues de PySimpleGUI/PySimpleGUI
Issues similares
-
essnmx good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
-
[Feature] 奇物选择添加优先级 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
syfoud/Simulated_Scepter#174 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Giskard-AI/giskard-oss#2840 · 1 comentario ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Abiertoarea: repo bug perceived difficulty: 2
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
yeti-platform/yeti#1380 ·