0

For some reason, even though I'm not sure why it's doing that, my program just closes the window instead of it doing what I want it to do

   while True:
     event, values = main_window.read()
     if event in (None,"Exit"):
         break
     if event == 'GPU info':
         print('cool')
     main_window.close()   

Any clues to how I change its behaviour to hide or do nothing when I press a button that is not exit?

eyal gelberg
  • 21
  • 1
  • 5

1 Answers1

1

main_window.close() is in the while loop.

  • 2
    I think you should make your explanation of how this causes the problem and how to fix it more obvious. – Yunnosch Aug 12 '22 at 22:22
  • 1
    Explanation - how this causes the problem: `close` closes the window INSIDE the while loop. The obvious fix: Move it out of the while loop. – Mike from PSG Aug 13 '22 at 14:55