0

I've created a program in Python on Codeanywhere so me and my friend can collaborate on the coding. In my code I use tkinter to create a GUI, but when I try to run the program I get an error:

Traceback (most recent call last):
  File "Client.py", line 7, in <module>
    import tkinter
ImportError: No module named tkinter

I've tried installing the tkinter module in the SSH terminal but that hasn't helped.

Can someone help me with using tkinter on Codeanywhere.com.

(I've also contacted them but they haven't gotten back to me)

Thanks in advance!

1 Answers1

1

In order to use Tkinter you would need to have a Xserver/GUI environment installed on your server but this does not seem possible in a cloud service.

Even if you try to fix this issue installing Tkinter using the following procedure described in this StackOverflow answer, you will end up having the following error:

_tkinter.TclError: no display name and no $DISPLAY environment variable

Error which basically states that the server is not able to find a display where to render your program.

As you can see here you would need to have a Xserver/GUI environment installed on the server.

I also tried a different cloud service (Pythonanywhere) to double check this and I had the same results. I checked the support forum and here you can see the answer from the staff, saying it's not possible to have Tkinter working on cloud service:

https://www.pythonanywhere.com/forums/topic/13628/

Giganicola
  • 11
  • 2