6

I'm using a website called "Repl.it" to code, and I recently found out that they have Pygame pre-installed. I tried using it, and when I tried to open a screen, I got this error:

Traceback (most recent call last):
File "python", line 3, in <module>
pygame.error: No available video device

Here's the code:

import pygame
pygame.init()
screen = pygame.display.set_mode((400,200))
screen.init()

I have very little coding experience so I have no idea how to fix this. Please help!

Not My Name
  • 63
  • 1
  • 6
  • It looks like you can't create a pygame display/window on repl.it. I've just checked it out and could only use some pygame classes like `pygame.Rect` and `pygame.math.Vector2`. They actually have a separate Python version with Turtle, but none for pygame. Just install Python and pygame and run your program on your computer. – skrx Jan 23 '18 at 01:53

1 Answers1

4

Repl.it does not support pygame windows. Sadly i can't think of any options for running pygame windows online, i think you have to run them locally.

jotjern
  • 460
  • 5
  • 18
  • I tried installing python and pygame, and when I import pygame, it thinks it doesn't exist. – Not My Name Jan 23 '18 at 16:40
  • Maybe you have multiple versions of python installed and you are using the wrong pip installation? Try doing pip3.6 or the version of python you are currently using when installing. Also you sometimes need to run CMD as administrator to install. – jotjern Feb 04 '18 at 13:02