Python Forum
[PyGUI] Threading in gui
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] Threading in gui
#1
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
Reply
#2
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
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020