Skip to content

Commit 0b98a14

Browse files
committed
Merge pull request matplotlib#2503 from mdboom/fix-interactive
Fix interactive mode detection
2 parents a81e931 + 02fc261 commit 0b98a14

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/__init__.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,11 @@ def interactive(b):
12621262

12631263
def is_interactive():
12641264
'Return true if plot mode is interactive'
1265-
b = rcParams['interactive'] and hasattr(sys, 'ps1')
1265+
# ps1 exists if the python interpreter is running in an
1266+
# interactive console; sys.flags.interactive is true if a script
1267+
# is being run via "python -i".
1268+
b = rcParams['interactive'] and (
1269+
hasattr(sys, 'ps1') or sys.flags.interactive)
12661270
return b
12671271

12681272
def tk_window_focus():

0 commit comments

Comments
 (0)