From the Tcl manual: info loaded ?interp?
Returns a list describing all of the packages that have been loaded into interp with the load command. Each list element is a sub-list with two elements consisting of the name of the file from which the package was loaded and the name of the package. For statically-loaded packages the file name will be an empty string. If interp is omitted then information is returned for all packages loaded in any interpreter in the process. To get a list of just the packages in the current interpreter, specify an empty string for the interp argument.
So:
Code:
package require Tk
# package name
set searched Tk
# get searched item from the list
foreach item [info loaded {}] \
{
foreach {file package} $item break
if {$package eq $searched} { break }
}
puts $file
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.