1

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)?

Pro Q
  • 4,391
  • 4
  • 43
  • 92

2 Answers2

1

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.

Mutahhir
  • 3,812
  • 3
  • 21
  • 26
1

If you want to get user input in a Python program in Cloud9, you could use text input. Tkinter doesn't work in Cloud9 because it has no way to interact directly with a window on your display; it is confined to a tab in your browser. Use raw_input in Python 2 and input in Python 3. See Python: user input and commandline arguments

Bennett Brown
  • 5,234
  • 1
  • 27
  • 35