Linux Today: Linux News On Internet Time.

Code Project: Build an Ncurses UI with Python

Apr 27, 2009, 13:32 (0 Talkback[s])

"n this guide, we'll show you how to write a nifty front-end for the useradd utility, a command which (unsurprisingly) lets you add user accounts to your Linux installation. Like many administration tools, useradd requires a long string of options and parameters; we're going to make it much simpler by creating an interactive dialog-driven version called UserMaster.

"Now, useradd is a fairly trivial tool and there's an alternative command, adduser, which prompts you step-by-step. But here we'll give you the code and techniques to make your own config tools - so at the end, you'll be able to write user-friendly utilities for starting services, clearing temporary files, or anything else you'd normally do at the shell prompt. Not only will this save you vital time when you're at the command line, but it means you can write config tools for other people who may log into your machines. If you run a server and don't want users trying to guesstimate super-complex commands, you can knock together a quick dialog-based version.

"As with our previous code projects (check them out - go on, just right-click the link and select Open Link in New Tab!), this guide assumes a smattering of programming knowledge. Don't worry: you don't need to be a coding whizz, but if you've played around with another language before, you'll be off to a flying start. But even if you've never written a line of code in your life, hopefully this tutorial will show you how programs fit together and what you can do. Enough chit-chat - let's get started with UserMaster..."

Complete Story

Related Stories: