简体   繁体   中英

How to open a URL from Tcl/Tk on Linux

How can I cause the browser to open a given URL from Tcl/Tk on Linux?

I'm using this proc on Windows, but I don't know what to do on Linux.

proc open_url {url} {
    eval exec [auto_execok start] $url
}

#example call:
open_url http://example.com

You can use xdg-open on Linux.

 exec xdg-open $url

There is some discussion here: Invoking Browsers on the Tcl wiki.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM