Tkinter problem: TclError> couldn't connect to display ":0

Chris Angelico rosuav at gmail.com
Sun Dec 29 16:40:56 EST 2013


On Mon, Dec 30, 2013 at 7:20 AM, Michael Matveev
<mischamv at googlemail.com> wrote:
> The shell gives out that kind of message:
>
> File "test.py", line 5, in <module>
> root = Tkinter.Tk()
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
> self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: couldn't connect to display ":0"

Worked for me on an installed Debian, inside Xfce with xfce4-terminal.

1) What version of Python are you running?
2) Are you running inside some kind of graphical environment?
3) Do you have any sort of permissions/environment change happening? I
get an error like that if I try "sudo python" without any sort of
guard.

ChrisA



More information about the Python-list mailing list