Hi,
I have just started using guizero on a Raspberry Pi4 and I have hit a wall. I followed the tutorial for theater tickets and it worked as stated. I am trying to use the GUI as a basis for relay control and I substituted GPIO statements to turn on relays. What doesn't work is that when I try to use the value of "row_choice" in an IF statement I get no results from the GPIO. If I substitute print statements for the GPIO.output statement nothing prints. It seems that I can only print the value befor the If statement. I must have something wrong in the IF statement but after consulting the manual i can't find it.
Thanks in advance for any help.
Chris
I have just started using guizero on a Raspberry Pi4 and I have hit a wall. I followed the tutorial for theater tickets and it worked as stated. I am trying to use the GUI as a basis for relay control and I substituted GPIO statements to turn on relays. What doesn't work is that when I try to use the value of "row_choice" in an IF statement I get no results from the GPIO. If I substitute print statements for the GPIO.output statement nothing prints. It seems that I can only print the value befor the If statement. I must have something wrong in the IF statement but after consulting the manual i can't find it.
Thanks in advance for any help.
Chris
from guizero import App,ButtonGroup,PushButton,info import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(14,GPIO.OUT) GPIO.setup(15,GPIO.OUT) GPIO.setup(18,GPIO.OUT) app = App(title="Antenna", width=300, height=200, layout="grid") row_choice = ButtonGroup(app, options=[ ["Long wire", 1], ["SlimJim", 2],["10m", 3],["Off", 0] ],selected=0, horizontal=True, grid=[1,2], align="left") def do_booking(): info("", "Selected") print(row_choice.value) if (row_choice.value)==1: GPIO.output(18,GPIO.HIGH) elif (row_choice.value)==0: GPIO.output(18,GPIO.LOW) book_seats = PushButton(app, command=do_booking, text="Select", grid=[1,3], align="left") app.display()