I have a raspberry pi with a lcd screen attached witch is mirroring the raspberry pi's display. I want to show a pygame window on it. When I run: python main1.py
on the ripi terminal the pygame window pops up perfectly on the ripi display.
However I am running my raspberry pi remotely from my windows machine using putty ssh. When I run python main1.py
on there it comes up it return pygame.error: Unable to open a console terminal
. From what I have read online it is trying to show the pygame display on my ssh putty window. I do not want this I want to have it show on my raspberry pi screen.
Is there a setting in putty or something in my script i can change to do this?
Thank You :)
2 Answers 2
I found this thread. I tested the solution between two of my personal computers, both running Linux.
To find out the value of $DISPLAY, use a keyboard hooked directly to the pi. Then in the terminal type echo $DISPLAY
The value will probably be :0.0
Then once you ssh into the pi, type
export DISPLAY=:0.0
(but replace the :0.0 with whatever value the echo $DISPLAY
turned up).
Also, if you don't have a keyboard, it's probably worth just assuming your display variable is :0.0 above.
Also make sure you have X forwarding enabled in your /etc/ssh/sshd_config
I had to edit /etc/lightdm/lightdm.conf to allow TCP connections as well as using export DISPLAY=:0