npyscreen.py

Rapid UI development for python/curses

(Putting a user interface on your hacks^W programs without all that mucking around in hyperspace)


Wouldn't it be really nice if asking the user to give you some information could be easy? As easy as:


	MyForm = Form()
	
	usrn_box = MyForm.add_widget(TitleText, name="Your name:")
	internet = MyForm.add_widget(TitleText, name="Your favourite internet page:")
	
	MyForm.edit()
	
	# usrn_box.value and internet.value now hold the user's answers.

If you think so, this library is for you.


This is a curses library and application framework for python that provides a reasonably comprehensive set of default widgets.

The best way to see how it works is to download the source code and have a look at EXAMPLE.py.

You can download the latest version of the software from Google Code or from PyPI.

If you want to install it, you can do:

python setup.py install

or, if you want to download and install from PyPI automatically:

easy_install npyscreen

You might also like to read the tutorial and documentation included with the distribution.

Strengths

This framework should be powerful enough to create everything from quick, simple programs to complex, multi-screen applications. It is designed to make doing the simple tasks very quick and to take much of the pain out of writing larger applications.

The framework is easy to extend. That said, if you have a requirement for a widget that is not currently included you can try emailing me and I'll see whether I have time to help - no promises!

Limitations

Recent versions of the library have support for the mouse. The default support is limited, but easily extended.

The library aims to support unicode/utf-8. Please report any problems using the bug-tracker at code.google.com/p/npyscreen.

I am working on a new mechanism for creating Forms which will make resizing forms automatic when the terminal resizes. However, in the meantime, the library will create forms based on a fixed size (determined when the Form is created). On the plus side, this library does make sure that a resized terminal will not cause your application to crash. (In fact, this library was first inspired by the desire to be able to write applications that would not crash merely because a terminal window had changed shape. Things rapidly got more complicated.)

Similar Projects

You might also like urwid.

Compared to npyscreen, urwid is more like a traditional, event-driven gui library, and targets other display devices as well as curses.