-1

I have tried moving the elif statements around but the compiler is still not executing elif event == submit. I will attach the relevant code here. I don't understand why the bottom most elif statement does not execute at all.

while True:
    event, values = window.read()
    print(values['-IN0-'])
    print(values['-IN1-'])
     
    if event == sg.WIN_CLOSED:
        if column in (0, 4):
            break
        else:
            show(-1)
    elif event in ('Exit'):
        break
    elif event.startswith("Prev"):
        show(-1)
    elif event.startswith("Next"):
        show(+1)     
    elif event == 'Submit':
        binFile1 = open("157.bin", "wb")
        binFile2 = open("158.bin", "wb")
        binFile3 = open("159.bin", "wb")
        binFile4 = open("160.bin", "wb")
        binFile5 = open("161.bin", "wb")
        binFile6 = open("162.bin", "wb")        
        binFile7 = open("163.bin", "wb")
        binFile8 = open("164.bin", "wb")        
        binFile9 = open("165.bin", "wb")
        binFile10 = open("166.bin", "wb")        
        binFile11 = open("167.bin", "wb")
        binFile12 = open("168.bin", "wb")
        binFile13 = open("169.bin", "wb")
        binFile14 = open("170.bin", "wb")
        binFile15 = open("171.bin", "wb")
        binFile16 = open("172.bin", "wb") 
        numb = int(values["-IN0-"])
        num_bytes1 = round(numb / 8)
        print(num_bytes1)
        filename = values['-IN1-']  
        start_time = time.time() 
       
        init = True 
WoohSteezy
  • 11
  • 2

1 Answers1

0

You might want to try.

else: 
    print(event)

just to see what comes up. Maybe 'Submit' is actually 'submit'. In that case you could change the code to read:

elif event.str.lower() == 'submit':

And that might resolve the issue.

JesseH
  • 83
  • 1
  • 9