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

Skip to content

ENH: Auto-detect interactive mode #4688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
import io
import locale
import os
import __main__ as main
import re
import tempfile
import warnings
Expand Down Expand Up @@ -1352,7 +1353,10 @@ def interactive(b):

def is_interactive():
'Return true if plot mode is interactive'
return rcParams['interactive']
ret = rcParams['interactive']
if ret is None:
ret = not hasattr(main, '__file__')
return ret
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To maintain the current returns change this to return bool(ret)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? This should always return a bool as hasattr returns a bool.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a None can fall through

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, never mind



def tk_window_focus():
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def __call__(self, s):
'toolbar': ['toolbar2', validate_toolbar],
'datapath': [None, validate_path_exists], # handled by
# _get_data_path_cached
'interactive': [False, validate_bool],
'interactive': [None, validate_bool_maybe_none],
'timezone': ['UTC', six.text_type],

# the verbosity setting
Expand Down