bhomass
bhomass

Reputation: 3572

can not find tkSnack.py

I set up my conda env on my Mac with python2.7, tk 8.6.7 and snack 0.0.3, but I still can't exec

import Tkinter
root = Tkinter.Tk()
import tkSnack

It says

ImportError: No module named tkSnack

locate tkSnack returns nothing.
locate snack returns:

/System/Library/Tcl/8.4/snack2.2
/System/Library/Tcl/8.4/snack2.2/libsnack2.2.dylib
/System/Library/Tcl/8.4/snack2.2/pkgIndex.tcl
/System/Library/Tcl/8.4/snack2.2/snack.tcl

The funny thing is there is both Tcl/8.4 and 8.5, but the tk in my env is 8.6.7. Is that a sign of trouble?

What is my problem here?

Upvotes: 3

Views: 5236

Answers (1)

vgonisanz
vgonisanz

Reputation: 11930

tkSnack is an interface to Kare Sjolander's Snack Tcl extension. You can find the code at Download page.

A way to install tcltk snack is using apt:

sudo apt-get install python-tksnack

Note: This will install the binary in the default computer path, conda maybe no detect them.

The file tkSnack.py is contain in repository source code, lastest version, inside python library. You have 2 ways to install python file if you are using conda, 1º you will have to put tkSnack.py in ${your_env_folder}/lib/python2.7/site-packages/. To know where is the base path use conda info --env. Alternativally, use command python setup.py install in python path directly.

If you have problems with conda, try installing so in the conda enviroment or moving them directly: cp /usr/lib/tcltk/snack2.2/* ${your_env_folder}/lib/

This is not a easy way, but works. If you want more info, check the official documentation

Upvotes: 1

Related Questions