I have an image hosted at a specific url online and I would like that image to appear in the terminal when run. Is that possible or is there a way the image can be shown in a native image viewer?
答案 0 :(得分:0)
You'll need some way of fetching and displaying the image. A web browser can do both of those things, so one way to do what you want is to start up a web browser and point it at the desired URL:
import webbrowser
webbrowser.open(url)
If the user already has a web browser open but it is not currently visible (i.e. it's minimized or it's on a different virtual desktop), it might work better to tell webbrowser
to open the page in a new window, which would (presumably) be displayed on the current screen:
webbrowser.open_new(url)
However, this is not guaranteed to work (perhaps the browser is configured to always display new urls in a tab instead of a new window, etc etc.)