Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pygame]

a cross-platform python framework including graphics and sound libraries for designing video games.

6
votes
2answers
12k views

Unable to run “sdl-config”

I'm new to Pi and Linux, and I'm using the Pi Zero W with a fresh version of Raspbian installed. I'm trying to get PyGame installed on the Pi so that I can work on a project. When I run the command ...
3
votes
3answers
1k views

Pygame and Alsa lib error

I am running a pygame window on a raspberry pi. The raspberry pi is connected to an lcd through gpio (not hdmi). My pygame script does not contain any mention of audio, only some basic rectangle ...
2
votes
2answers
4k views

How to change audio output device for Python?

On a clean install of Raspbian Jessie I want to play mp3s via mplayer through my Sabrent USB Audio driver. On Raspbian itself this was plug n' play; I changed the default audio device to "USB Audio ...
2
votes
1answer
35 views

Run pygame Python script on my laptop screen which I use to SSH into my pi

I have a raspberry pi with raspbian installed. I ssh into it using PuTTY, an ethernet cord, and my laptop. My goal is to run a pygame script on the pi but display it on the laptop screen. I have been ...
2
votes
1answer
764 views

Pygame from command line vs GUI

I'm working on a small pygame app using a Pi 1 Model A but have noticed that it performs worse/differently as a kiosk app (run from command line without starting LXDE) than starting LXDE and running ...
1
vote
1answer
2k views

Kernel throwing up all kinds of errors over night

I am developing a system that uses OpenCV with Python to access the csi camera, and PyGame for the GUI. Due to the nature of the system (security program) it needs to be left unattended pretty much ...
1
vote
1answer
1k views

pygame.error: No available audio device

I'm using Raspberry Pi 3b, usb mic and 3.5mm audio jack as speaker. mic is hw:1,0; speaker is hw:0,0 Everything works fine except that I'm unable to get pygame.mixer.Sound.play() in a python script ...
1
vote
3answers
1k views

No audio output using raspberry pi and pygame.midi

I have a Raspberry Pi 2 and a set of speakers connected to the 3.5mm headphone jack. I've got most audio coming out of my speakers by running amixer set name='PCM Playback Route' 1. pygame.mixer ...
1
vote
1answer
599 views

Pointer moving randomly [Touchscreen TFT]

My 320x240 2.8" PiTFT (#1601) reached me yesterday. I install Jessie-based PiTFT 2.4" and 2.8" Resistive Image for Pi 1 and Pi 2 (September 24, 2015) image to my sdcard. At first everything seems ...
1
vote
1answer
38 views

PyGame for Jukebox without display

I want to great a small (local) jukebox without a display. Songs are stored on the SD card and every button is more or less hardwired to one song (always to the song called "1.mp3" on the sd card ...
1
vote
1answer
776 views

rpi 3B+ problems installing pygame into virtual env

I have a clean and updated raspbian stretch on rpi 3B+. I created a virtual environment. Activated it. Compiled python 3.7 in the venv. Installed pyephem into it with pip. All is working fine in the ...
1
vote
1answer
311 views

RPi 7" touch display gives bad touch coord after reboot

I've got a fullscreen pygame app being run on boot, and it looks like the touch coords it gets immediately after boot are bad. pos = pygame.mouse.get_pos() For instance, if I touch in the center of ...
1
vote
1answer
458 views

Pygame axis values

how can I see the values that come from the different joystick axis? For example, if i press the joystick half up, that there is a value of 1600 (all the way up: 3200). There is the event.axis, but it ...
1
vote
1answer
940 views

Read GPIO.output to make something happen in PyGame

I'm stuck :-) I've build a simple program with pygame. I have a rectangle (pygame.draw.rect(screen, state_color1 , ( 50, 450, 150, 5)) that changes color when it's pressed. Changing the state_color1. ...
1
vote
1answer
66 views

Running pygame and webcam works from command line not when using a service

I am writing a small program for a Museum display that captures a still from a webcam, displays it on screen, waits a few seconds and takes another, loop forever. This all works fine from the command ...
1
vote
1answer
41 views

Raspberry pi zero arduboy

I saw the arduboy some time ago and got quite interested in it. I'd like to know if it is possible, through some kind of os, to make something of the sort with a raspberry pi zero w(make my own games ...
1
vote
0answers
231 views

c310 logitech webcam not closing properly in pygame code

I'm accessing my c310 logitech webcam in python with pygame in an attempt to take pictures and save them. My final goal is to take a new picture every minute for 24 hours to make a timelapse. Here is ...
1
vote
1answer
6k views

Send image from one raspberry pi to another via socket

I am new to posting questions on this site so forgive me if this isn't in the best place or if I do something wrong. I have two Pi's and I am trying to capture images in a loop (giving me a video), ...
1
vote
0answers
230 views

Incorrect Pygame touch events from Raspi Display without startx

I have a Clock / Weather / MPD client PyGame application that runs on a Raspi3 with an official Raspi Touchscreen. The app works fine when executed under startx. When started from the command line, ...
1
vote
1answer
593 views

Launch RetroPie from Pygame script on PiTFT?

As the title suggests, I'm trying to launch RetroPie from a Pygame script. I'm using a 2.8" PiTFT from Adafruit. In order to launch EmulationStation on the PiTFT, I'm using fbcp. In order to ...
1
vote
0answers
274 views

Run brushless motor with esc

I have looked all over the internet on how to run a brushless motor with an esc through RPi.GPIO and have no results. I have tried simply wiring the esc as it is supposed to be and programming it ...
0
votes
1answer
26 views

Pygame does not recognize number pad?

i use a small USB number pad/number keyboard for my Raspberry. It works well but my problem is, that it does not work with Pygame. I want to use the RETURN key with: elif event.type == pygame....
0
votes
1answer
857 views

Pygame run on external screen using ssh

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 ...
0
votes
1answer
890 views

How to play music on Raspberry Pi?

I have a code with which I want my Raspberry Pi to play a certain set of music playlist from a folder. top_mood=max(mood_happy,mood_sad,mood_angry,mood_shocked,mood_romantic) if top_mood==...
0
votes
1answer
1k views

fatal python error: (pygame parachute) Segmentation Fault, vision system using simplecv

I am fairly new to both the raspberry pi and python. I have written a code to analyze an image, but I keep getting fatal python error: (pygame parachute) Segmentation Fault. It usually occurs between ...
0
votes
2answers
2k views

Why can't I get audio to play with pygame only once?

I'm sorry if this has been answered, I looked and cannot find the solution. So I'm trying to play a sound only once from a raspberry pi using pythons pygame library. The raspi is hooked up via hdmi ...
0
votes
0answers
13 views

No available Audio Device after switch from NOOBS to Raspbian Stretch

my program uses Pygame to play sounds. I used Noobs before and my program worked fine in Thonny. Now, i switched to Raspbian Full Stretch and now I get the error No available Audio Device. I already ...
0
votes
0answers
16 views

Which screen size in Pygame for an 3.5 inch LCD?

i try to fill out my whole LCD screen in Pygame with the best sharp resolution possible. So there is a difference between computer screen and the LCD. My LCD has resolution is 480×320. So choosing ...
0
votes
0answers
17 views

How to send data across usb0 to use in pygame?

So i have a pi3b+ and a zero hooked up to a tft ili9341 display. I can run pygame on boot and it works fine. I have also started using python sockets and successfully sent data (my wlan0 ip) from my ...
0
votes
0answers
22 views

Add Touch Mode feature to Minecraft Pi

I have Raspberry Pi 3 Model B+ with 5 inches Display with touchscreen for my challenge [Display works successful!]. I am using Debian Raspberry OS. I am on the file in /home/pi/mcpi/api/python/mcpi/...
0
votes
0answers
18 views

PyGame GUI hidden by program

I am working on creating a graphical program to display two lines of text (a big message and a small message) on my Raspberry Pi Touchscreen using the module pygame. In the basic terminal, I can pass ...
0
votes
0answers
38 views

High CPU usage from PyGame with time.sleep

so I'm running a very rudimentary webcam surveillance program with PyGame, that just takes a picture from the webcam, stamps the time and saves it in an endless loop. (and does some simple date ...
0
votes
0answers
80 views

Pygame initalisation for TFT on /dev/fb1 only succeeds as root

I connected a 320x240 TFT to my Raspberry Pi A+ running Raspbian stretch via SPI and set it up as fbtft_device. It shows up in /dev/fb1 and I can write images to it via pygame. I initialize it like ...
0
votes
1answer
97 views

Python script loads on startup with a GUI, but none of the fonts load with it

I'm working on integrating my raspberry pi into a car display that shows some OBDII readouts. However when I auto start my python script none of the fonts get loaded and it looks like this: However, ...
0
votes
1answer
212 views

Display a pygame window on builroot custom linux

I'm using Buildroot 2018.02 to create a custom Linux to run my raspberry pi 3. I'm trying to display a pygame window on the external hdmi screen from command line. So far, I've been able to boot the ...
0
votes
0answers
614 views

Why won't pygame play sound over Bluetooth when everything else works?

I having trouble getting a program I've written using the pygame sound mixer to play sound to work over Bluetooth. The program is able to work correctly over HDMI audio. The Raspberry Pi has no ...
0
votes
0answers
135 views

photobooth, gphoto2, pygame, problem with saving pictures

Hello recently i downloaded photobooth script that I want tweak a little bit to suit my needs and I tried to edit. #!/usr/bin/env python # Created by br _at_ re-web _dot_ eu, 2015-2016 import os ...
0
votes
0answers
350 views

Running pygame without X results in stuck black screen

I'm trying to run a Pygame app without using X. I have a Raspberry Pi 3 with raspbian Jessie installed with very few modifications. The script I'm trying to run is the following: #!/home/pi/.env/bin/...
0
votes
1answer
1k views

Cannot get pygame to open a wav file

I copied this program from a previous reply on this site: import pygame pygame.mixer.init() pygame.mixer.music.load('beep.wav') pygame.mixer.music.play() while pygame.mixer.music.get_busy()==True: ...
0
votes
1answer
459 views

Interfacing pygame with dispmanx - performance

I'm working on a graphical application, made for console mode, and facing some performance issues when working with large resolution (1920px wide here). One part of the display, a video background, ...
0
votes
1answer
338 views

Code runs VERY slowly. Any tips to speed it up?

The following code is meant to create 6 GPIO pins and be able to change the output of each of those pins depending on the letter pressed (I made it a function because I will have to code each letter, ...
0
votes
1answer
2k views

How open a pygame console terminal through SSH (JuiceSSH)?

I have made a piece of code with pygame on the Raspberry Pi and I want to run it through the Android app JuiceSSH so I can use it on my Android phone. But whenever I run it on my phone, even with '...
0
votes
1answer
567 views

pyame joystick button bounce

I'm building a pi robot. It uses a ps3 controller for input. When the X button is pressed, it takes a photo. For some reason, it takes around 5 shots at a time. Is there a way to bounce the input so ...