The "enter" key in pycharm only jumps to new line without sending my massege

Viewed 104

I've tried every solution that I found on google so far and nothing seems to work...

client_input = ""


def listen_for_input():  # reads the input and adds to string returns 
whether pressed enter
    while msvcrt.kbhit():  # there is input waiting to be read
        key = str(msvcrt.getch())
        if key == b'\r' or b'\n':  # pressed enter
            return True
        else:
            global client_input
            client_input += key.decode("utf-8")  # Add encoded char to 
string
    return False   
0 Answers
Related