다음과 같은 문제가 있습니다. 다음 코드가 있다고 가정합니다.
@window.event
def on_key_press( symbol, mod):
if condition == True:
return print("Game over")
pyglet.app.run()
조건 == True가 충족 된 후에도 창을 닫아야합니다. 제발 어떻게 할 수 있습니까? 나는 시도했다 :
@window.event
def on_key_press( symbol, mod):
if condition == True:
return print("Game over")
pyglet.app.exit()
하지만 작동하지 않았습니다. 도움을 주셔서 감사합니다!
이 기능은 return
제어 흐름에서의 첫 번째 발생시 종료됩니다 . return
진술 을 제거해야 합니다.
@window.event
def on_key_press( symbol, mod):
if condition == True:
# return print("Game over") <--- DELETE
print("Game over")
pyglet.app.exit()
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다