Python Forum

Full Version: Threading in gui
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello fellow programers

I am new to python and i have a Rasberry PI 4 , 2 GB.

I am building a button matrix with 80 buttons, (matrix style is 8x12) and want to implement to work with GUI.

Matrix is in WHILE loop and if i put it anywhere in program, program is not responding, it stays in matrix loop.

Next thing i have tried to make a matrix loop run in THREAD (only one thread, that checks for button presses) but i dont know how to call a thread to start when i start GUI.

Also i want that GUI reads button matrix and if a button is pressed it should update it in text widget or similar.

I will later implement matematics behind button matrix.

Can you please help, or refer to some resources so i can learn.

Best regards, and thanks in advance,
Josip
The while loop detects the GPIO event-changes when a button is pressed.
What stops you from calling a function outside the while loop?
while ...
if GPIO.event_detected(16):
do_something():
Paul