vendredi 24 juin 2016
set up $DISPLAY VARIABLE
While trying to use the python turtle module to write a program I came across an issue. I have turtle installed but after I ran the code below for testing purposes:
import turtle
import random
turtle = turtle.Turtle()
I came across this error in the terminal. There have been similar questions on stackoverflow but those pertained to matplotlib which was also having the same error and the answers for the matplotlib error could not be applied to turtle. Below is the error in the terminal.
File "", line 1, in
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.py", line 3702, in __init__
Turtle._screen = Screen()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.py", line 3552, in Screen
Turtle._screen = _Screen()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.py", line 3568, in __init__
_Screen._root = self._root = _Root()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/turtle.py", line 458, in __init__
TK.Tk.__init__(self)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/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
My question is how do I set up an environment $DISPLAY variable. I have also made sure that I have tkinter intstalled. This is a mac computer with python 2.7.
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire