I try to run pygame in ubuntu 16.04 vps server. it works with "ssh -X root@server_ip". But pygame gives error when ssh connection without -X.
pygame.display.set_mode((self.w, self.h),DOUBLEBUF|OPENGL)
pygame.error: No available video device
I install x11 in server and it works.Even so pygame error continues.
code :
os.environ['SDL_VIDEODRIVER'] = 'x11'
pygame.init()
pygame.display.set_mode((self.w, self.h),DOUBLEBUF|OPENGL)
x11 status:
root@vps423325:~# service x11-common status
● x11-common.service - LSB: set up the X server and ICE socket directories
Loaded: loaded (/etc/init.d/x11-common; bad; vendor preset: enabled)
Active: active (exited) since Tue 2017-06-27 00:15:02 CEST; 11h ago
Docs: man:systemd-sysv-generator(8)
Process: 1002 ExecStart=/etc/init.d/x11-common start (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 0B
CPU: 0
Jun 27 00:15:02 vps423325 systemd[1]: Starting LSB: set up the X server and ICE socket directories...
Jun 27 00:15:02 vps423325 x11-common[1002]: * Setting up X socket directories...
Jun 27 00:15:02 vps423325 x11-common[1002]: ...done.
Jun 27 00:15:02 vps423325 systemd[1]: Started LSB: set up the X server and ICE socket directories.
You have to install Xming X Server for Windows for this to work and displaying the content on your machine. Download and install XMing from here : https://sourceforge.net/projects/xming/ and try again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.