1

I am currently trying to make pygame run on my Ubuntu 20.04 machine. After getting the error 'No available video device' I added the following lines of code:

import os
os.environ['SDL_VIDEODRIVER'] = 'dummy'

Now the error message is gone, but the window still does not pop up... I am using python 3.8.3 and pygame 2.0.0.dev10.

Does somebody know what I am missing?

b_stan
  • 21
  • 4

1 Answers1

3

Because setting SDL_VIDEODRIVER to "dummy" it won't actually render anything. As stated at the bottom of the wiki:

If you need an event queue but don't want a real window, try putenv("SDL_VIDEODRIVER=dummy") before you call SDL_SetVideoMode. I find this useful in apps that use SDL facilities, but don't need a real video output device.

Since you are on Linux, you will need to set the value of SDL_VIDEODRIVER to one of the Linux video drivers which can be found here.

If it still doesn't work, you may need to re-install your video drivers or something is wrong with one of your SDL packages and they may need to be re-installed.

Cho'Gath
  • 448
  • 3
  • 9
  • 1
    Thanks for your answer! I tried reinstalling all the packages, which also didn't do anything. Fixed the problem by adding: os.environ['DISPLAY'] = ': 0.0' – b_stan Oct 16 '20 at 10:32