Permalink
Browse files

Display URL if not set to open webbrowser

  • Loading branch information...
1 parent 0c99763 commit 6e735d5969cecf5e5c6483e29c6ab5d5b0b715bd @mdboom mdboom committed Oct 23, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/matplotlib/backends/backend_webagg.py
@@ -44,12 +44,15 @@ def draw_if_interactive():
class Show(backend_bases.ShowBase):
def mainloop(self):
WebAggApplication.initialize()
- if rcParams['webagg.open_in_browser']:
- import webbrowser
- print("Opening in webbrowser")
- for manager in Gcf.get_all_fig_managers():
- webbrowser.open("http://127.0.0.1:{0}/{1}/".format(
- WebAggApplication.port, manager.num))
+ for manager in Gcf.get_all_fig_managers():
+ url = "http://127.0.0.1:{0}/{1}/".format(
+ WebAggApplication.port, manager.num)
+ if rcParams['webagg.open_in_browser']:
+ import webbrowser
+ webbrowser.open(url)
+ else:
+ print("To view figure, visit {0}".format(url))
+
WebAggApplication.start()
show = Show()

0 comments on commit 6e735d5

Please sign in to comment.