Skip to content
python ncurses library to generate, print and manipulate tables
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
curseXcel Package changes Mar 1, 2018


python ncurses library to generate, print and manipulate tables


A simple solution to tabulating information and data direct within the terminal. Using the famous ncurses module for python, curseXcel lets you customise and fill your table with ease, and then quickly present it anywhere on the terminal window.

If the table extends beyond the limits of the screen that you have set, curseXcel allows you to scroll across the x and y planes to find you information.

As always, a picture says a thousand words: Screenshot


First you need to follow standard ncurses procedure to create your screen and/or window.

import curses

def main(stdscr):
	x = 0
	while ( != 'q'):
		x = stdscr.getkey()

stdscr = curses.initscr



Then you are free to create your table. Some variables are essential, while others a customisable:

from curseXcel import Table
table = Table(win, rows, cols, cell, width, height, col_names=None, spacing=None)   # the last two are optional

Here is an example put together:

table = Table(stdscr, 4, 6, 5, 20, 30, spacing=1, col_names=True)
m = 0
while m < 6:
	table.set_column_header("Col " + str(m+1), m)
	m += 1
m = 0
while m < 4:
	n = 0
	while n < 6:
    		table.set_cell(m, n, n+m)
    		n += 1
	m += 1

An extended test file is included.

Below are each of the functions that can be used and their usage:

Table.cursor() 				# returns the cursor position as a tuple
Table.set_cell(row, col, value) 	# places a string into a cell
Table.print_table() 			# prints the table to the screen
Table.refresh() 			# clears the screen, prints table then refreshes screen
Table.cell() 				# returns the contents of a cell as a string
Table.set_column_header(value, col) 	# places a string into the column header if set
Table.cursor_left() 			# moves cursor left
Table.cursor_right() 			# moves cursor right
Table.cursor_up() 			# moves cursor up
Table.cursor_down() 			# moves cursor down
Table.delete_column(col) 		# deletes the column from the table
Table.delete_row(row) 			# deletes the row from the table
Table.clear_cell(row, col) 		# removes the contents of a cell
Table.clear_row(row) 			# removes all the contents of a row
Table.clear_column(col) 		# removes all the contents of a column

Quickstart guide


  • curses (should be installed in standard library)

There are multiple installation methods:

Make sure you are running python3


> sudo pip install curseXcel			# may have to run pip3


  • download file to a location of choice
> cd 'path'
> sudo python3 install		# can use just python if error


> sudo pip uninstall curseXcel


curseXcel - create tables with ncurses

Copyright (c) 2017 coffeeandscripts

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

You can’t perform that action at this time.