curseXcel icon indicating copy to clipboard operation
curseXcel copied to clipboard

table.cell() / table.cursor()

Open mbolder opened this issue 5 years ago • 0 comments

Hi,

i am using the table so far without any problems, but when trying to read a value from a cursor I cannot work out, what I am suppose to do. Based on the example I thought after e.g. a table.cursor_down() was triggered I would get the cell value like a = table.cell() or the cursor tuple like cur = table.cursor(). But I get either int or list object is not callable... How would one implement this ?

`

import curses
from curseXcel import Table

def main(stdscr):
	a = ""
	x = 0
	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
	table.delete_row(2)
	while (x != 'q'):
		table.refresh()
		x = stdscr.getkey()
		if (x == 'j'):
			table.cursor_left()
		elif (x == 'l'):
			table.cursor_right()
		elif (x == 'k'):
			table.cursor_down()
			a=table.cell()
		elif (x == 'i'):
			table.cursor_up()

stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(True)

curses.wrapper(main)

curses.nocbreak()
stdscr.keypad(False)
curses.echo()
curses.endwin()

`

mbolder avatar Oct 14 '20 07:10 mbolder