Questions tagged [pygame]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
28 views

USB sound card not working after reboot on RPi4

I am using an external USB sound card with my Raspberry Pi 4 and play music using pygame. To set the audio output from the 3.5 mm minijack to the USB sound card I first checked the available outputs ...
0
votes
0answers
37 views

Using datetime how can I trigger a change based on the minute of the hour?

I'm trying to edit a Python script that works perfectly - except I want to change one variable and I can't figure out how to do it. The script plays a set of mp3 files in a directory. The script ...
0
votes
0answers
70 views

Playing audio on Bluetooth speaker using pygame

I know there are already posts related to this question, but there aren't any I can find that have worked for me. I am attempting to get an iHome B66 Bluetooth speaker to play sound coming from my ...
0
votes
0answers
34 views

Using Motion Library with pygame.camera

I have a python file that works standalone to take a photo, then post it to an api, but I want this file to be run when motion is detected on my livestream using on_event_start. The file begins as ...
0
votes
1answer
45 views

Bind pygame surface to dispmanx element

I have managed to create a dispmanx element from a python script. I want to write text on this element. I can do it with pygame, but pygame does not provide layer feature. I need this feature for ...
0
votes
1answer
82 views

Draw something over omxplayer

I am playing a video with OMXPlayer in fullscreen mode. What I want to do is to draw something. I want to see my video by transparency. I have tried with pygame, but I cannot see both videos and ...
0
votes
2answers
81 views

Is it possible to connect 2 mouses on a raspberry pi

I want to connect 2 USB mouses on the same raspberry pi. I want to see 2 cursors (blue and red) on the screen. Is it possible ? Thanks
0
votes
1answer
356 views

No sound trying to play a Python sound on Raspberry Pi [closed]

Just wondering if anyone can help me get the sound to work on a Raspberry Pi? I keep getting an error message: Sound = pygame.mixer.Sound('/home/pi/gpio-music-box/samples/drum_tom_mid_hard.wav') ...
0
votes
0answers
62 views

Is there a way to loop through GPIO pins and a database in python

I have built a set of musical stairs using raspberry pi, motion sensors and python, and a web app to change the instrument using PHP. The python connects to a mysql database storing the instrument ...
0
votes
0answers
111 views

Python, pygame.mixer, wait for track to end

A little stuck on the last part of this code. I want a random track to play until the end when a switch is switched. I would like the track to play no matter how many times the switch is switched ...
1
vote
0answers
76 views

pygame small screen missing mousecklicks

I am using a small 2.4" touchscreen with a resolution of 320x240 and I am working with pygame to create a GUI. Strangely I am not recording any mouse click between y position 26 and 35. The problem ...
0
votes
0answers
53 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
26 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 ...
1
vote
1answer
111 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
303 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/...
1
vote
2answers
453 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
94 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 ...
2
votes
1answer
220 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 ...
0
votes
0answers
35 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
1answer
113 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
281 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, ...
2
votes
1answer
2k 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
4k 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 ...
0
votes
1answer
418 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 ...
3
votes
0answers
1k 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
197 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 ...
3
votes
3answers
3k 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 ...
1
vote
1answer
2k 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
0answers
569 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
3k 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: ...
1
vote
0answers
314 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 ...
0
votes
1answer
702 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, ...
2
votes
2answers
7k 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
8k 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), ...
12
votes
2answers
23k 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 ...
0
votes
1answer
578 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
1k 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==...
1
vote
0answers
262 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, ...
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 ...
1
vote
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
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 ...
2
votes
1answer
476 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 ...
0
votes
1answer
654 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 ...
1
vote
1answer
661 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 ...
2
votes
1answer
1k 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
3answers
2k 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
528 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
1k 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
654 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
0answers
293 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 ...