-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do i detect Control key sequences? #222
Comments
im in raw mode. I saw your other issues and i found that i could use the sequence \x01 for control c for example. |
Same thing for me. Variant of the "rich event loop" snippet for reference: #!/bin/python3
from blessed import Terminal
term = Terminal()
print(f"{term.home}{term.black_on_skyblue}{term.clear}")
print("press 'q' to quit.")
with term.raw():
val = ''
while val.lower() != 'q':
val = term.inkey(timeout=3)
if not val:
print("It sure is quiet in here ...")
elif val.is_sequence:
print("got sequence: {0}.".format((str(val), val.name, val.code)))
elif val:
print(f"got {val}. ({val.code})")
print(f'bye!{term.normal}') When launching it from Bash, almost all
Edit: tried with keymatrix.py, and the code seems to be reported there |
What's an example of a key you're seeing in keymatrix that you aren't seeing in the above code? |
Hello @Minabsapi, Try changing,
to,
that is, display repr(val) rather than str(val) -- as the |
Closing as duplicate of #58 |
Im trying to detect ctrl+c or other variants in my vscode terminal. Ctrl sequences seem to not appear when using inkey.
The text was updated successfully, but these errors were encountered: