Search code examples
pythonuser-inputcloud9-ide

How to get user input in Cloud9 (Python)


I've just started using Cloud9 to program with Python.

But when I try to use Tkinter it gives me the error _tkinter.TclError: no display name and no $DISPLAY environment variable.

How should I get user input with Python in Cloud9 (either by setting up this display, or by using another method)?


Solution

  • Cloud9 hosted workspaces don't have graphics hardware, so you won't be able to run any GUI toolkits on it. If you'd like to get user input, best would be to run a server that serves an HTML based form that can be used to collect input. The server should listen to 0.0.0.0:8080 and will be accessible on http://<workspacename>-<username>.c9.io. Check out this page to get a quick start on serving html pages on Cloud9.