The Unfun Cat
The Unfun Cat

Reputation: 31908

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

As I said, I have installed Python 3.3 from Macports.

Now when I do a spotlight search for Idle

Idle -- Python 3.3

shows up. However when I try to click it, nothing happens. No error is shown or anything- it plain does not start.

What do you think might be wrong?

It is reminiscent of this question: Python 3.0 - Idle wont open. It just bounces in the dock

The difference is that I get no error messages and am using 3.3


Update:

Now I tried setting Py3.3 as my main version using macports select. Then I tried opening IDLE from the console and got the following error message:

  Traceback (most recent call last):
  File "/opt/local/bin/idle", line 5, in <module>
    main()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PyShell.py", line 1421, in main
    root = Tk(className="Idle")
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/tkinter/__init__.py", line 1756, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Upvotes: 3

Views: 10931

Answers (2)

Javi12
Javi12

Reputation: 163

I had same problem with python32 port on my OS X Lion 10.7.5 and got fixed simply by installing py32-tkinter port. I checked and already has installed X11. Thanks.

Upvotes: 0

kheyse
kheyse

Reputation: 1919

Using macports, install py33-tkinter

sudo port install py33-tkinter

Edit: Make sure you have X11 or Xquartz installed too.

Upvotes: 3

Related Questions