question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Quick shortcuts assignment

See original GitHub issue

It would be awesome to be able to define one or two quick options like exit or go back (customisable) and mappable to different keys !

For example:

> aaa
bbb
ccc
ddd
(q) Exit
(;) Go Back

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
IngoMeyer441commented, Sep 11, 2020

@buanzo: v0.9.0 is released and adds configurable accept keys. You can now do something like:

#!/usr/bin/env python3

import os
from simple_term_menu import TerminalMenu


def main():
    terminal_menu = TerminalMenu(["entry 1", "entry 2", "entry 3"], accept_keys=("enter", "alt-d", "ctrl-i"))
    terminal_menu.show()
    print(terminal_menu.chosen_accept_key)


if __name__ == "__main__":
    main()

to distinguish different accept keys and or modifiers.

1reaction
IngoMeyer441commented, Sep 11, 2020

Version v0.8.0 includes support for shortcuts by prepending single keys in square brackets before every menu entry. Have a look at the README for more info. @buanzo That is still not what you need. Maybe, we could add support for multple shortcut keys and set the pressed key in a property of the TermMenu instance? Or do you simply want to press modifier keys when selecting a shortcut?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize keyboard shortcuts - Microsoft Support
Use a mouse to assign or remove a keyboard shortcut · In the Press new shortcut key box, press the combination of keys...
Read more >
How to Assign Keyboard Shortcuts to Programs in Windows 10
Right-click on the program shortcut and select Properties. · Under the Shortcut tab, in the Shortcut key field, simply type the shortcut you...
Read more >
Assigning a shortcut key—Help | Documentation
Assigning a shortcut key · Click the Customize menu and click Customize Mode. · Click the Keyboard button on the customize dialog box....
Read more >
Tech Savvy Tips and Tricks: Keyboard Shortcuts
Working with files and applications · Alt+F4: Quit the current application. · Windows key: Open the Start menu. viewing the Windows key on...
Read more >
Keyboard Shortcuts for Mac - Things Support - Cultured Code
Edit items ; Open selected item, Return ; Save and close item, ⌘ Cmd Return ; Duplicate selected item, ⌘ Cmd D ;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found