Question

I created a Python command-line application. One of the features is that it prints a list of items taken from database when you call it with -l switch. Each item has associated a detailed description.

1: item1
2: item2
3: item3
4: item4

What is a good pattern for TUI design (in command-line) to be intuitive and comfortable for the user when he wants to display a description for particular item in the list?

Now, my app is quite cumbersome. The item is prefixed by number and when you want to see a description, function getch() waits for key press in the interval (1..9) and prints a description for item with given index. I can't use mouse position (which would be more comfortable) because it's command-line application. Another thing is, where is the most suitable place to print a description, to be able to repeatedly remove it and print description for another item, so the screen is not cluttered with uninteresting information? The user should display only the information that interests him in a particular moment.

The length of the list is unlimited. The interval (0..9) is temporary solution.

What is a good practice for this TUI design? Would you use some TUI library helping with this? If so, show some typical pattern with or without using a library of your choice.

I'm using Python, but feel free to use another imperative language in case the same can be achieved in Python

Thank you

Was it helpful?

Solution

1) This question https://stackoverflow.com/questions/791261/python-text-user-interface in its answers have many great libraries mentioned which seem fit for this task.

2) I would suggest to provide Arrow Keys as valid input [some of the libraries above can handle this] intead of only number based section. For example the NCDU tool (which is an ncurse based disk usage tool) has a great text based UI using arrow keys, you might want to refer to it as an example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top