I did write a small and easy Tkinter program by the ssh connection:
Code: Select all
from Tkinter import *
# if you are working under Python 3, comment the previous line and comment out the following line
#from tkinter import *
root = Tk()
w = Label(root, text="Hello Tkinter!")
w.pack()
print ('test ')
root.mainloop()
I try to achieve that the Tkinter programm shows up at the monitor by the HDMI by executing from the ssh connection.
If I try to runt it from the ssh connection the next error occurs:
python gui.py
Code: Select all
Traceback (most recent call last):
File "gui.py", line 5, in <module>
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
before executing
Now the error shows:
Code: Select all
No protocol specified
No protocol specified
Traceback (most recent call last):
File "gui.py", line 5, in <module>
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1813, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0.0"
What am I doing wrong?
How to start this Tkinter programm from ssh connection but running on the HDMIconnection?
EDIT:
I did found the solution.
First you need to start up in GUI mode after reboot
You need to enter the GUI mode under the same login as the ssh connection
the you need to execute at the ssh connection: export DISPLAY=:0.0
Than running the GUI programm