andrey
andrey

Reputation: 1585

Starting with Tkinter for python

The sample:

# gui.py

from Tkinter import *
root = Tk()

Results in:

$ python gui.py
Traceback (most recent call last):
  File "gui.py", line 3, in <module>
    root = Tkinter.Tk()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1814, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

I'm running python 2.7.10 under cygwin.

What am I doing wrong?

Upvotes: 1

Views: 660

Answers (1)

SiHa
SiHa

Reputation: 8411

It seems that you need to install an X server as TCL now requires it.

This mailing list post mentions it:

You need to install X, define the DISPLAY environment variable, and start X. After these steps, your Tkinter program should work again.

Upvotes: 1

Related Questions