Skip to content
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

TerminalMenu does not release the terminal if inside another class. #92

Open
c0ntact0 opened this issue Jun 3, 2024 · 2 comments
Open

Comments

@c0ntact0
Copy link

c0ntact0 commented Jun 3, 2024

Follows the example to clarify:

from simple_term_menu import TerminalMenu

class Test():

    def main(self):
        options = ["entry 1", "entry 2", "entry 3"]
        terminal_menu = TerminalMenu(options)
        menu_entry_index = terminal_menu.show()
        input("Enter something: ") # terminal does not respond
        print(f"You have selected {options[menu_entry_index]}!")

if __name__ == "__main__":
    test = Test()
    test.main()

The input() blocks the terminal.

@c0ntact0
Copy link
Author

c0ntact0 commented Jun 3, 2024

UPDATE: It only happens that the program is stopped abruptly, such as stopping the program in debug state.
Sorry for that.

@IngoMeyer441
Copy link
Owner

Sorry, I have completely overlooked this issue. I tried your code, but for me, it behaves like intended: After selecting an entry from the menu, input blocks and continues when the Enter key is pressed. How does it behave for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants