First Code Help Question (Python O_O) - Termios

Anyone know how to use termios (or similar) in python to get “intermittent” input. That is, it’s possible to be collecting a yield generator or similar of input and pause the input half way through, and then restart it?

For example:

generator = inter_input('\n') # terminates on newline
# uses next(generator) to sequentially get next char

it’s important that it uses the built-in for keybinds because I still want the keybinds to be printed to the screen pressed by the user. I guess it’s possible for things like getkey to be edited using termios to print the characters so I’d basically like anything where I can do the above, whether it be through single key getting with yield generator or just a single key getter function as long as it prints to screen and does keybinds (like if it deletes it should delete and what not) even better if it just returns current string so far (to get delete to work :sob:)

1 Like

You could probably make a custom class with a __next__. And use same-line inputs.

2 Likes

yeah I wish that worked but I’ve tried a couple of times and I want to make sure the keybinds are the same as input (like when you delete, console will update)

1 Like

The only way I can think of to reset a generator is just to call whatever function returns it again.

1 Like

yeah I guess it’s a tall order I just couldn’t find any stackoverflow

1 Like

Just wondering… what does the yield generator have to do with termios?

EDIT: wait nvm I think I get it now

1 Like

yeah basically termios can edit console settings so I was wondering if there was a way to get intermittent ver of input where you can pause it ;-;

1 Like

I still don’t get why you can’t do that with multiple same-line inputs. If you want I can whip up a example.

1 Like