Skip to content

Commit 166d638

Browse files
authored
Merge pull request #12707 from ImportanceOfBeingErnest/fix-tk-closedfigure-mainloop
FIX: tk error when closing first pyplot figure
2 parents 694b482 + b3d2b08 commit 166d638

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/backends/_backend_tk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,4 +1037,6 @@ def trigger_manager_draw(manager):
10371037

10381038
@staticmethod
10391039
def mainloop():
1040-
Tk.mainloop()
1040+
managers = Gcf.get_all_fig_managers()
1041+
if managers:
1042+
managers[0].window.mainloop()

0 commit comments

Comments
 (0)