Skip to content

Commit 56bc297

Browse files
committed
FIX: support returning on last window close with show
But if there is a timeout you have to wait the full timeout no matter what.
1 parent 9246961 commit 56bc297

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mpl_gui/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ def show(figs, *, block=None, timeout=0):
7878
if block and len(managers):
7979
# TODO expose the main loop more elegantly!
8080
# TODO make timeout work!
81-
# _cbm().Show().mainloop()
82-
manager, *_ = managers
83-
manager.canvas.start_event_loop(timeout=timeout)
81+
if timeout == 0:
82+
_cbm().Show().mainloop()
83+
elif len(managers):
84+
manager, *_ = managers
85+
manager.canvas.start_event_loop(timeout=timeout)
8486

8587

8688
class FigureRegistry:

0 commit comments

Comments
 (0)