Display url using the default browser. If possible, open url in a location determined by new. - 0: the same browser window (the default). - 1: a new browser window. - 2: a new browser page ("tab"). If possible, autoraise raises the window (the default) or not. If opening th
(url, new=0, autoraise=True)
| 73 | # instead of "from webbrowser import *". |
| 74 | |
| 75 | def open(url, new=0, autoraise=True): |
| 76 | """Display url using the default browser. |
| 77 | |
| 78 | If possible, open url in a location determined by new. |
| 79 | - 0: the same browser window (the default). |
| 80 | - 1: a new browser window. |
| 81 | - 2: a new browser page ("tab"). |
| 82 | If possible, autoraise raises the window (the default) or not. |
| 83 | |
| 84 | If opening the browser succeeds, return True. |
| 85 | If there is a problem, return False. |
| 86 | """ |
| 87 | if _tryorder is None: |
| 88 | with _lock: |
| 89 | if _tryorder is None: |
| 90 | register_standard_browsers() |
| 91 | for name in _tryorder: |
| 92 | browser = get(name) |
| 93 | if browser.open(url, new, autoraise): |
| 94 | return True |
| 95 | return False |
| 96 | |
| 97 | |
| 98 | def open_new(url): |
no test coverage detected
searching dependent graphs…