Answer the question
In order to leave comments, you need to log in
Why does the program window hang when the loop starts?
What is the problem?! When I start and press button 1, the cycle starts and because of this the program window hangs to all buoys, but the cycle itself works until the program is killed, closed. Why does it hang where I messed up the shit?
Here is the code
import PySimpleGUI as sg
import keyboard
import time
def BS():
while True:
if keyboard.is_pressed('space'):
while keyboard.is_pressed('space'):
keyboard.press_and_release('space')
time.sleep(1.03)
else:
pass
layout = [[sg.Button('1'), sg.Button('2'), sg.Exit()] ]
window = sg.Window('Test').Layout(layout)
while True:
event, values = window.Read()
if event in (None, 'Exit'):
break
if event == '1':
BS()
elif event == '2':
pass
window.Close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question