S4L v6.0 python pip install tkinter

Hi guys,

I have s4l v6.0 installed on my PC. I would like to develop some python scripts which needs tkinter modules.

I tried to directly import tkinter module, but it shows that "no module named tkinter".

Then, I tried to pip install tkinter in the command prompt window. But it comes up with "Could not find a version that satisfies the requirement tkinter"

It seems that tkinter is already installed with python 3.x versions, but I do not know what is wrong with my installation.

Hi guOLU,

Unfortunately the Python version that is bundled with Sim4Life does not include tkinter and it is far from trivial to install it manually. We are working on a solution but it is hard to say when it will be ready to be released.

In the meantime if you provide more detail on what you are trying to do, maybe we can find a workaround?

Are you maybe not capitalizing it correctly?
This works in Sim4Life 5.2 (haven't used S4L 6)

from Tkinter import Tk

(I use it to copy an input file name to clipboard)

@montanaro are you possibly using the Python2 version? I think only Py2 has Tkinter with a capital T...

@montanaro Yes, Sim4life 5.2 should be fine. The Python version should be v2.7, I think. However, Sim4life 6.0 is using Python 3.6.8. I think this version may have some issues with tkinter package.

Perhaps, Sim4life 7.0 may fix this issue I guess.

Oh, too bad ... Yeah, it was working on Python 2.7

I remembered you (Sylvain) had a post about pip installing new packages, I found it here

https://forum.zmt.swiss/topic/10/how-to-install-additional-python-packages

Maybe this helps? Or maybe better to find another workaround to what you're trying to do

@sylvain Thanks for your help. I agree with you that this problem is caused by the Python version. Perhaps, may the Python version be upgraded in the next Sim4Life version, v7.0?

For me, actually, I would like a window popped out to selected the desired file and folder. Then I could have the directories of these files. Based on my experience, using Tkinter is an easy way to achieve this.

Currently, I already used the other modules to achieve the similar function. But it is just not as convenient as using Tkinter.

@guolu Could you share your solution? I would like to do the same. Thanks in advance.