Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Python
from turtle import *
begin_fill()

Turtle()
right(90)
forward(80)
left(90)
forward(80)
left(90)
forward(80)
left(90)
forward(80)

color('red')
end_fill()
done()




This is my code.And shows this error... Please help me


Traceback (most recent call last):
  File "main.py", line 2, in <module>
    begin_fill()
  File "<string>", line 6, in begin_fill
  File "/usr/local/lib/python3.7/turtle.py", line 3812, in__init__
    Turtle._screen = Screen()
  File "/usr/local/lib/python3.7/turtle.py", line 3662, inScreen
    Turtle._screen = _Screen()
  File "/usr/local/lib/python3.7/turtle.py", line 3678, in__init__
    _Screen._root = self._root = _Root()
  File "/usr/local/lib/python3.7/turtle.py", line 434, in __init__
    TK.Tk.__init__(self)
  File "/usr/local/lib/python3.7/tkinter/__init__.py", line 2023, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable



What I have tried:

I tried so many times , and it didn't work
Posted
Updated 15-Jan-20 23:14pm
v2
Comments
Richard MacCutchan 16-Jan-20 4:20am    
_tkinter.TclError: no display name and no $DISPLAY environment variable

1 solution

That is not an error of your code. Simply the environment variable DISPLAY is not defined (or visible to the code). You may find some info, for instance, here: raspbian - Error when attempting to create Python GUI using Tkinter: "no display name and no $DISPLAY environment variable" - Raspberry Pi Stack Exchange[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900