How to use the getch.getch function in getch

To help you get started, we’ve selected a few getch 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 coffeemug / ankify / ui.py View on Github external
def pick_image():
    sys.stdout.write("Image number 1-8 (or 'q') ")
    sys.stdout.flush()
    while True:
        res = getch()
        if res.isdigit():
            res = int(res)
            if res in range(1,9):
                print()
                return int(res)
        else:
            if res == 'q':
                print()
                return None
github yselivonchyk / TensorFlow_DCIGN / autoencoder.py View on Github external
def _on_training_abort(self, sess):
    print('Press ENTER to save the model')
    if getch.getch() == '\n':
      print('saving')
      self.saver.save(sess, self.get_checkpoint_path())
github PhanLeSon03 / Mic_Array / C_DOA_BF / Window / Verify_For_C / BF / google_BF.py View on Github external
class Google(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
    def Run(self):
        # recognize speech using Google Speech Recognition
        print("Google asking")





while True:
    print("press --a-- to exit")
    print("press --any button-- to record")
    key = getch.getch()
    
    
    if key=='a':
        break
    else:
        print("**** recording *******")
        ind = 0
        idxFrame = 0
        idxFrameLoad = 0
        for i in range(0, int(numCHUNK)):
            Frames_1024 = MIC_ARRAY.Read()

            Beam_Audio = BEAM.BFCalc(Frames_1024,6)

            '''Sound Source Localization'''
            idxDir = LOC.Update(Frames_1024)
github MadcowD / tensorgym / tf_demo / expert_recorder.py View on Github external
print("NOTE: Make sure you've selected the console window in order for the application to receive your input.")

    while not esc:

        done = False
        _last_obs = env.reset()
        while not done:
            env.render()
            # Handle the toggling of different application states



            # Take the current action if a key is pressed.
            action = None
            while action is None:
                keys_pressed  = getch.getch()
                if keys_pressed is '+':
                    esc = True
                    break

                pressed = [x for x in BINDINGS if x in keys_pressed]
                action = BINDINGS[pressed[0]] if len(pressed) > 0 else None

            if esc:
                print("ENDING")
                done = True
                break

            obs, reward, done, info = env.step(action)
            
            no_action = False
            sarsa = (_last_obs, action)
github cs50 / submit50 / opt / cs50 / submit50 / bin / submit50.py View on Github external
def authenticate():
    # prompt for username
    while True:
        print("GitHub username: ", end="", flush=True)
        username = input().strip()
        if username:
            break

    # prompt for password
    while True:
        print("GitHub password: ", end="", flush=True)
        password = str()
        while True:
            ch = getch.getch()
            if ch == "\n": # Enter
                print()
                break
            elif ch == "\177": # DEL
                if len(password) > 0:
                    password = password[:-1]
                    print("\b \b", end="", flush=True)
            else:
                password += ch
                print("*", end="", flush=True)
        if password:
            break

    # authenticate user
    two_factor.auth = (username, password)
    email = "{}@users.noreply.github.com".format(username)
github nh-server / Kurisu / addons / bf.py View on Github external
cellptr += 1
                if cellptr == len(cells): cells.append(0)

            if command == "<":
                cellptr = 0 if cellptr <= 0 else cellptr - 1

            if command == "+":
                cells[cellptr] = cells[cellptr] + 1 if cells[cellptr] < 255 else 0

            if command == "-":
                cells[cellptr] = cells[cellptr] - 1 if cells[cellptr] > 0 else 255

            if command == "[" and cells[cellptr] == 0: codeptr = bracemap[codeptr]
            if command == "]" and cells[cellptr] != 0: codeptr = bracemap[codeptr]
            if command == ".": output += chr(cells[cellptr])
            if command == ",": cells[cellptr] = ord(getch.getch())

            codeptr += 1
            loops += 1

            output = output.replace("@", "@\u200b")
        await self.bot.say("{}: {}".format(self.bot.escape_name(ctx.message.author.name), output))
        if loops == 50000:
            await self.bot.say("note: capped at 50,000 loops")
github unicornx / osrusbfx2 / linux / scripts / python / osrfx2.py View on Github external
def handle_clear_one_bar():
	print("Which Bar (input number 1 thru %d)?" %(BARGRAPH_MAXBAR))
	try:
		bar = int(getch())
	except:
		print("Error reading input!")
		return

	if(bar == 0 or bar > BARGRAPH_MAXBAR):
		print("Invalid bar number!")
		return

	bar = bar - 1 #normalize to 0 to 3
	barValue = BARGRAPH_OFF; # reset and flag off
	barValue = barValue | (1 << bar)

	if (0 != set_bargraph_display(barValue)):
		print("set_bargraph_display failed with error")
		return

getch

Does single char input, like C getch/getche

Public-Domain
Latest version published 12 years ago

Package Health Score

43 / 100
Full package analysis