-1

I want to do something like this

while True:
    fuction()
    function_that_checks_if_q_is_pressed()
    if function_that_checks_if_q_is_pressed==True:
        break
    break

Quick notes:

I'm using ios mojave.

i'm using python 3.9.

The "keyboard" python library isn't working for me.

I am using the pynput library but I would also be happy to use a different library if it works.

Thank you so much!

Raz P
  • 1
  • 1
  • Does this answer your question? [Checking a specific key with pynput in Python](https://stackoverflow.com/questions/53693820/checking-a-specific-key-with-pynput-in-python) – Tomerikoo Nov 29 '20 at 10:52

1 Answers1

0
import keyboard

def function_that_checks_if_q_is_pressed():
    if keyboard.read_key()=="q":
        print(True)

while True:
    function_that_checks_if_q_is_pressed()
    if function_that_checks_if_q_is_pressed==True:
        break
    break
Nathan E
  • 63
  • 6