Python Forum
guizero repeat command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
guizero repeat command
#1
I am new to guizero and Python in general but I'm fighting my way through it and I think I'm almost there.

Essentially, I'm making a barcode comparing app. I'm using guizero to:

-bring up a first pop-up to collect a first scan
-bring up a second pop-up to collect a second scan
-Compare them
-App turns green if they are the same, red if they are not
-Wait a little
-Clear inputs and turn app background gray again

I also have a status message to state what process it is doing

Where I am having issues is that when that sequence is done, I want it to start back at bringing up the first pop-up.

I found the repeat command but it isn't working the way I need. When I use repeat, it runs regardless of where I am in my sequence and just endlessly brings up my first pop-up. If I was writing in C, I would just wrap my command, a wait and app.display() in a while loop but that doesn't apply in Python.

What could I do to repeat my command, without a set amount of time?

Never mind. I don't know if it was the right way but I just did:
while True:
    compare()
    app.update()
    
app.display()
This works!
Reply
#2
I don't like your GUI. From your description I would expect there to be 1 window with two buttons, a Store button that grabs a bar code and a Compare button that scans a bar code and compares it to the stored barcode. This would let me grab one scan and do multiple comparisons.
Reply
#3
I didn't like the GUI either. It started out with buttons but ended up not having any at all. Thinking back on this, going with a GUI was a little much for the application and completely unnecessary. It was a fun learning experience though.

Shortly after I got this working, I ended up scrapping the GUI and going with a little OLED display. Now I am working on changing out the GUI code to code for a SSD1306 display.

I wasn't sure where I was going to put the 3.5" display anyway. I found out that with the OLED display I will be able to modify my USB barcode scanner to hold the pizero and the 0.96" OLED. The whole thing will be contained in the scanner and all it will need is power.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Example of guizero ListBox jreebel 1 2,239 Oct-29-2020, 08:17 PM
Last Post: Larz60+
  Trying to clear a list automatically at certain times (guizero) reneejerden 3 2,846 Jul-26-2019, 05:13 PM
Last Post: Denni

Forum Jump:

User Panel Messages

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