IngoMeyer441 / simple-term-menu

A Python package which creates simple interactive menus on the command line.
MIT License
492 stars 43 forks source link

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

Open c0ntact0 opened 3 months ago

c0ntact0 commented 3 months ago

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 commented 3 months ago

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

IngoMeyer441 commented 2 months ago

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?