Npyscreen is a Python framework for creating text-based user interfaces (TUIs) that run directly inside the terminal. It’s built on top of the curses library and provides widgets like forms, buttons, lists, and input fields to help developers build interactive console applications quickly. It’s perfect for dashboards, setup tools, and CLI-based management systems.
Installation:
pip install npyscreen
Example usage:
import npyscreen
class MyApp(npyscreen.NPSAppManaged):
def onStart(self):
self.addForm("MAIN", MainForm)
class MainForm(npyscreen.Form):
def create(self):
self.name = self.add(npyscreen.TitleText, name="Name:")
self.age = self.add(npyscreen.TitleText, name="Age:")
self.add(npyscreen.ButtonPress, name="Submit", when_pressed_function=self.submit)
def submit(self):
npyscreen.notify_confirm(f"Hello {self.name.value}, age {self.age.value}!", title="Result")
if __name__ == "__main__":
MyApp().run()
PyPI page: https://pypi.org/project/npyscreen/
GitHub page: https://github.com/npcole/npyscreen
3 Project Ideas:
- Build a terminal-based task manager or to-do list.
- Create a server monitoring dashboard inside the terminal.
- Develop an interactive setup wizard for command-line applications.
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.