Changing the colour of a pushbutton using python/raspberry pi - python

I'm working on a project for work which is essentially a remote monitor that looks at the status of drawbridges. I have a GUI set up that i designed with PyQtDesigner with 8 buttons that are currently coloured red and want them to go green when drawbridges come down. I'm using the GPIO on a raspberry pi to get a signal from the drawbridges but cant get the buttons to change to green.
self.pushButton_7.setStyleSheet("background-color: red")
that's how the buttons are coloured initially but unsure how to change them to green with an input from the raspberry pi, any pointers will be super helpful!
(totally new to pi's and python!)

Related

How to open tkinter GUI window while opencv webcam is running?

We are now working on a thesis based on drowsiness detection within a car. Our code is on a while loop and every time it detects up to 5 or more seconds to be driver is drowsy, the GUI must show up to alert the user that the car is slowly breaking. My problem is while the opencv webcam is runnning (for the drowsiness detection), the tkinter GUI won't show up. Is there any way to like overlap the tkinter window from the webcam frame running in the background?

Is there a way my program can detect if my microphone is being used by any programs? (Windows 10)

SHORT VERSION:
I'm attempting to detect when my microphone is being captured by a program like Discord, preferably in Python, but I can't figure out how to do it. Any suggestions?
LONG VERSION:
I'm trying to write a program that will turn on an "On Air" light whenever my microphone is being used. Typically this would either be for Discord or Twitch. This is something Windows already monitors as well (Windows 10) because it displays a microphone icon down in the notifications tray and tells you what programs are using your microphone. Basically, whenever that icon notification is up, I want my light to be turned on.
The light is currently being run by sending serial commands through Python to an Arduino Nano, but I can only manually tell it to turn on or off.
I can't find a way to access windows privacy monitoring status or make any headway on just checking if a microphone is in use with Python. Any suggestions?
You can lock if the MicrophonIcon is displayed. Presice write an Pythonscript that locks if Pixel at the Position of the MicrophoneIcon having the Color off the MicrophonIcon. qt can do this. It has a python binding.
Get the Position of the MicrophonIcon( you can hover over it with the mouse and use a program to look the position up)
Get some Pixel Colors off the aria with qt
write a loop that checks if the Pixel Colors at the moment are equal to messured ones.
Con: if the Position off the Microphon changes(Screensize, other options that push it, not visable( fullscreen)) It will not work.
If you checke the yello lines in 2 loops it should define the Microphone icon nearly failsafe if the position isnt changing

Python listening and analyzing data at the same time

TL;DR- Python listens to live audio and reacts accordingly on the go.
I am a complete beginner to Python, this is my first idea i'd love to work on. So it all began with me "hacking" my LED strips i have connected to WiFi. I can easily switch their color by launching a file and make them do certain pattern one time (haven't tried repeated/infinite patterns). My goal is to make it listen to music played on computer (essentially listen to system sounds one could say) and analyze the low bands and depending on the intensity of them, change the LED colors. As example music plays and lights switch color on each beat.
I haven't tried anything so far.
Lights work completely fine as i enter custom RGB and brightness values.

Raspberry pi using a button as a toggle for a servo

I have a raspberry pi using pigpio to control two servos with two buttons. Right now I have to hold the button to make the servo move. I want the buttons to toggle the servos between the two positions, but my attempts fail.
I'm on mobile so i put a picture of my code, sorry I couldn't paste it.
Code Picture
Note: the commented code is from when i was using gpiozero to control the servos, but it caused jittering so I switched to pigpio. The comments are there just in case I have to switch back for whatever reason.
To toggle between positions you need to know when the positions are reached.
Do you have limit switches?
Can you measure the increase in current when the motor reaches the limit?
Can you send the motor to a position by setting an angle?

how to Embed video into tkinter window in raspberry pi?

I want to make Queue Management application using Raspberry pi. I want to design my window using tkinter. On that window I want some portion will show the token no and counter no and other portion will show videos. How could i embed video on my window. Other functions I could manage easily but no idea about video. Please help me how could i embed video in my window.

Categories