Quantcast
Channel: Raspberry Pi Forums
Browsing all 1579 articles
Browse latest View live

Python • How to light up a LED when an IR signal is received, using events ?

Hello,I'm trying to light up a LED on GPIO pin 17 when an IR signal is received on GPIO pin 23. LIRC is also configured to listen to IR signals on this PIN through dtoverlay=gpio-ir,gpio_pin=23 in...

View Article


Python • How to clear stored variable data while app / window is in mainloop

I took someone else's code that I found online for a keypad / pin checking system and expanded it so that it can check several pins instead of just one. I presume it's ok post my version since it's...

View Article


Python • Re: How to clear stored variable data while app / window is in mainloop

Place the pins in a file and persist new pins in this file.Easy done if file format is json:Code: {"PIN1": "1111", "PIN2": "2222", "PIN3": "3333"}For convenience, wrap all the pin functionality in one...

View Article

Python • Python query

HiI am trying for the first time to reorganise my files in my project into multiple py files and am running into a problemI have a class defined in file A. I create an instance of this class in...

View Article

Python • Re: New to Python Topic

Not too much information about the code structure in your post. Here a working sample of two files- file_A.py, defines a class A- main.py, imports a class A from file_A.py. Calls a method from this...

View Article


Python • Re: how do you install numpy in venv?

Have you usedCode: pip listto see if its installed already?Statistics: Posted by RaspyHat — Sat Dec 13, 2025 11:57 am

View Article

Python • Re: Problem with print in a for loop.

It's more than that.You need to give the full error code and nowaday it will also point to the errors. But that depends on the Python version you are using.I believe the %s \n part is expecting one...

View Article

Python • Unable to load / install RPLCD on RPI 5

HiI am trying to install the RPLCD module to use a 16x2 line LCD display. I get the below error.sudo pip install RPLCDerror: externally-managed-environment× This environment is externally...

View Article


Python • Re: Unable to load / install RPLCD on RPI 5

sudo pip3 install rpi_lcd --break-system-packagesWorks for me with i2c lcdsStatistics: Posted by gordon77 — Wed Dec 17, 2025 8:12 am

View Article


Python • installing with apt in venv ?

I have trouble trying to install modules...LCD_MP3_Player.py contains import alasaudio..Code: gt64tr@gt64tr:~ $ source myfirstproject/bin/activate(myfirstproject) gt64tr@gt64tr:~ $ sudo apt-get...

View Article

Python • Re: installing with apt in venv ?

Install the package with apt as normal - although it looks like you've already installed it.Create the venv with "--system-site-packages". That will allow it to use the apt installed...

View Article

Python • [SORTED] installing with apt in venv ?

I have trouble trying to install modules...LCD_MP3_Player.py contains import alasaudio..Code: gt64tr@gt64tr:~ $ source myfirstproject/bin/activate(myfirstproject) gt64tr@gt64tr:~ $ sudo apt-get...

View Article

Python • Re: subtracting times with datetime

A little late, but MySQL has a command for that:Code: create table test (log_time timestamp default current_timestamp());insert into test (log_time) values(default);select...

View Article


Python • Python Threads Intorduces 10msec Delay in SPI

I am using python3 and pigpiod on an RPi 4b.I have an application thar reads 48 bytes from a SPI device. The device will only do byte transfers so this is done in a loop. There are also two I2C...

View Article

Python • Re: Python Threads Intorduces 10msec Delay in SPI

No idea, but maybe the way Python works.Have a look at Pythons GIL, you can turn this off in Trixie Python version 3.13, but it is still quite experimental, until you get to the newer Python version...

View Article


Python • a browser-based flowchart-to-Python tool

I’ve built a browser-based flowchart-to-Python tool designed for teaching programming concepts visually. Students can create, run, and export code directly from their flowcharts, with support for...

View Article

Image may be NSFW.
Clik here to view.

Python • Re: a browser-based flowchart-to-Python tool

'fraid it's not generating a loop when it should be.I was expecting an infinite loop around the last two boxes.Editied to remove unnecessary details from image.Statistics: Posted by thagrol — Sat Dec...

View Article


Python • Re: Python / Flask server not displaying embedded text data on...

I'm kinda confused with this execution and embedding of python. You're in python? Why don't you create a route for the pin.py (and it doesn't even have to exist) and embed your code in the route?Code:...

View Article

Python • compile python from source with tkinter support

All,I have a python project that requires tkinter. I am attempting to compile python from source.And no matter what I do, I get the following error in the configuration step: checking for stdlib...

View Article

Python • Re: compile python from source with tkinter support

I am not sure what you are aiming for, here is an example using tkinter to spawn a window.Code: #!/usr/bin/env python3"""Simple Tkinter window for Raspberry Pi 3 (Python 3)."""import tkinter as tkdef...

View Article
Browsing all 1579 articles
Browse latest View live