How to Install Packages in Tcl

can't find package fileutil in TCL(how to install it for third party TCL interpreter)

As slebetman wrote, adsp2_ia.exe probably can't find the ActiveTcl library files, but you can import the package yourself. In my 8.6.1 installation, the file is at C:\Tcl\lib\teapot\package\tcl\teapot\tcl8\8.2\fileutil-1.14.8.tm. Your location or version number may be different, but note that you are looking for a .tm file. It will not be in any directory named fileutil, those are for related packages.

(Another slebetman pointer:) It may be possible to make the module visible by calling ::tcl::tm::path add with the path as argument.

If not, use source to import the code. Make the call in the global scope, outside of any procedure.

Then you should be able to call package require fileutil.

Documentation: package, source, tm

tcl tk teacup install from file

Firstly, you have to run the command as a user that has permission to write to the local repository of installed packages. For Windows, that might require you to run the teacup install as administrator (NB, I'm not sure that the installation package for tktreectrl is called tktreectrl.dll; I suspect it's called something else but don't know what):

runas /user:administrator "teacup install C:\path\to\tktreectrl.dll"

However, the fact that the main teacup archive isn't carrying the treectrl 2.4.1 package is a problem all of its own. Have you tried dropping a line to the people at ActiveState?

How to install packages of tcl in MAC OS X?

If you are having trouble installing a package, you can use it in the same directory of your project. What you need to do is to append the folder of your library (the one that contains the pkgIndex.sh) file to the auto_path list on your code before the package requere command.

It would be something like this:

#!/usr/bin/tclsh

lappend ::auto_path /Users/ninguem/Dropbox/prg_new/tcltk/png_test/Img1.4.11

package require Tk
package require Img

image create photo icon -file "icon.png"
image create photo iconDisabled -file "icon.png" -format "png -alpha 0.5"
button .b -image icon

In this example, I don't have the Img package installed. So, the first thing I had to do was to add the line with lappend ... in the beginning of the code.

According to the documentation, the Tcl interpreter will look for libraries on all the paths on this list.

I struggled a bit with that at first, but it turns out that using libraries in Tcl is pretty simple.

How to specify tcl compiler in Tkinter library?

The Tcl global variable auto_path contains a Tcl list of directories to look for packages in. Add a directory to it using lappend as you probably don't want to remove the existing entries in it:

tclsh.eval("lappend auto_path /path/to/add")
tclsh.eval("package require tclvisa")

You can also control this by setting the TCLLIBPATH environment variable before loading the Tkinter package. Assuming that Tkinter doesn't interfere with that itself…



Related Topics



Leave a reply



Submit