Python Forum
Free Online IDE / Interpreter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Free Online IDE / Interpreter
#1
I'm trying to get into game development, but for some reason I am unable to install pygame or any of its dependencies on my Chromebook, despite having Linux enabled and Python3 installed. I was wondering if there is a free online IDE / Interpreter that has all the Python libraries included, to allow me to run scripts that make use of these libraries? I've tried One Compiler and a couple others, but when I attempt to import pygame or other libraries, I get an error that says:

Error:
Traceback (most recent call last): File "main.py", line 1, in <module> import pygame ModuleNotFoundError: No module named 'pygame'
Any help would be very much appreciated.
buran write May-27-2024, 06:40 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#2
(May-27-2024, 04:26 PM)Jameyson72 Wrote: ModuleNotFoundError: No module named 'pygame'
Have you tried
Output:
apt-get install python3-pygame
to install pygame from a linux terminal?

I don't know chromebooks but This pdf document looks interesting in your case.
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
There are many good online environment like eg Codespaces, Replit, Colab
The problem with Pygame is that in need native OS stuff,so no window will show up in browser in these environments.

I don't have Chromebook so untested.
Step 1: Ensure Linux (Crostini) is Enabled
Scroll down to Linux (Beta) and turn it on.

Step 2: Update Linux and Install Dependencies
sudo apt-get update
sudo apt-get upgrade
Step 3: Install dependencies and Python3 and Pip
sudo apt-get install libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev
sudo apt-get install python3 python3-pip
Step 4: Install pygame
pip3 install pygame
Step 5: Verify the Installation
# test_pygame.py
import pygame
pygame.init()

# Set up display
window = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Pygame Test')

# Main loop
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

pygame.quit()
In terminal.
python3 test_pygame.py
Pedroski55 and XavierPlatinum like this post
Reply
#4
I use a chrome book. And this code tested good.

print("Try programiz.pro")
import math
import time

def myfunc(Image):
    player = "RossKagawa5.jpg"

print("This picture is UH baseball 1987.")
myfunc("RossKagawa5.jpg")
Try programiz.pro
This picture is UH baseball 1987.

=== Code Execution Successful ===
Programs are like instructions or rules. Learning it gets us closer to a solution. Desired outcome. Computer talk.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with free online book Ummusabbar 4 3,879 Mar-11-2018, 12:34 PM
Last Post: Ummusabbar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020