moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.77k stars 245 forks source link

After the screen is locked, the string is printed to the back of the screen #459

Open 21pages opened 2 years ago

21pages commented 2 years ago

Description

As the title says, the correct password cannot be entered via the remote control after the screen is locked because the string is entered behind the screen

Platform and pynput version Platform: xubuntu 20.04 pynput: 1.7.6

To Reproduce code:

from pynput.keyboard import Key,Controller
import time

print("start")
keyboard = Controller()

def loop():
    global keyboard
    while True:
        keyboard.tap("a")
        keyboard.tap(Key.space)
        keyboard.tap("1")
        keyboard.tap(Key.down)
        print("\n")
        time.sleep(5)
loop()

Run this code, then lock the screen, and find that "1" and "a" cannot be automatically entered into the password box, only spaces are entered. After unlocking the screen, the terminal displays as follows:

a 1^[[B

a 1^[[B

a 1^[[B

a 1^[[B

a1

a 1^[[B

a 1^[[B

a 1^[[B