Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bfaada

Browse files
committed
FIX: call draw idle on auto-show
If a window is shown due to being in interactive mode, call draw_idle. This draw will be executed when the next time python is idle. This makes running plotting scripts with python -i test.py correctly auto-display/draw when dropping into the repl.
1 parent a4ed400 commit 6bfaada

File tree

7 files changed

+7
-0
lines changed

7 files changed

+7
-0
lines changed

lib/matplotlib/backends/backend_gtk.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ def destroy(*args):
586586
self.window.connect("delete_event", destroy)
587587
if matplotlib.is_interactive():
588588
self.window.show()
589+
self.canvas.draw_idle()
589590

590591
def notify_axes_change(fig):
591592
'this will be called whenever the current axes is changed'

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def destroy(*args):
451451
self.window.connect("delete_event", destroy)
452452
if matplotlib.is_interactive():
453453
self.window.show()
454+
self.canvas.draw_idle()
454455

455456
def notify_axes_change(fig):
456457
'this will be called whenever the current axes is changed'

lib/matplotlib/backends/backend_macosx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def notify_axes_change(fig):
386386

387387
if matplotlib.is_interactive():
388388
self.show()
389+
self.canvas.draw_idle()
389390

390391
def close(self):
391392
Gcf.destroy(self.num)

lib/matplotlib/backends/backend_qt5.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ def __init__(self, canvas, num):
500500

501501
if matplotlib.is_interactive():
502502
self.window.show()
503+
self.canvas.draw_idle()
503504

504505
def notify_axes_change(fig):
505506
# This will be called whenever the current axes is changed

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ def new_figure_manager_given_figure(num, figure):
112112
figManager = FigureManagerTkAgg(canvas, num, window)
113113
if matplotlib.is_interactive():
114114
figManager.show()
115+
canvas.draw_idle()
115116
return figManager
116117

117118

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ def new_figure_manager_given_figure(num, figure):
12361236
figmgr = frame.get_figure_manager()
12371237
if matplotlib.is_interactive():
12381238
figmgr.frame.Show()
1239+
figure.canvas.draw_idle()
12391240

12401241
return figmgr
12411242

lib/matplotlib/backends/backend_wxagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def new_figure_manager_given_figure(num, figure):
124124
figmgr = frame.get_figure_manager()
125125
if matplotlib.is_interactive():
126126
figmgr.frame.Show()
127+
figure.canvas.draw_idle()
127128
return figmgr
128129

129130

0 commit comments

Comments
 (0)