Snappy and tkinter incompatibility

Hi there,

I have noticed something strange going on with snappy and the tkinter module.
In my script, I open a folder using the gui from tkinter:

root = tk.Tk()
fname = filedialog.askdirectory(initialdir=".", title=‘Open:’)
return fname

which yields the selection box.

I am working in Python 3.4 in a anaconda virtual environment. I install snappy by doing the following (in the virtual env):

  • Go to the jpy folder and do

python --maven build

  • Navigate to snap/bin/ and do

./snappy-conf /home/username/anaconda3/envs/environement_name/bin/python

At this point the tkinter GUI still works fine, but I can’t use snappy. So I go to /snap/snappy and do:

python install

At this point I can import snappy, however when I run the code, the tkinter window is frozen: i.e. I can access the buttons and the navigation bar, but the folders are not clickable. The window also makes the program hang and I need to force restart the kernel (working in Spyder).

Any idea what this could be due to?

That’s interesting! So you are just importing snappy and the tkinter UI freezes?
Does it make a difference when you change the position of the import statement before or after the tkinter imports?

Would be great if you could make the code available, at least the lines of code that reproduce the behaviour.


Hi Norman,

You are right, the code is sensitive to the import order. I hadn’t though of trying that.

If I import Tkinter before snappy, the GUI freezes, whereas if I import snappy first, it works fine. I wonder what that is due to…

I have attached a working piece of code to test it out. (932 Bytes)