So I am learning how to use tkinter and I am making a simple app, the problem happens when I try to open the application from the vscode terminal:
(base) leonardo@rosen:~/Documents/projects/simple_calculator$ ./calculator.py
Traceback (most recent call last):
File "./calculator.py", line 5, in <module>
root = tk.Tk()
File "/home/leonardo/anaconda3/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
Now the strange thing, is that I am able to run the application from the regular terminal, but not from the integrated terminal in vscode. Also, I have the code runner extension and if "run in the terminal" is set to false, it will also open the application. But the same error above will show up if it is set to true.
Lastly, running which python3
from both the integrated terminal and the regular terminal results in the same:
/home/leonardo/anaconda3/bin/python3
I think it has something to do with how vscode deals with anaconda, since just opening the terminal results in the following (it automatically runs these commands to open a virtual environment):
leonardo@rosen:~/Documents/projects/simple_calculator$ source /home/leonardo/anaconda3/bin/activate
(base) leonardo@rosen:~/Documents/projects/simple_calculator$ conda activate base
(base) leonardo@rosen:~/Documents/projects/simple_calculator$
but the error occurs even if I deactivate the (base) environment. Is there a setting I should change? is it fine that it opens in (base) environment automatically?