ragardner / tksheet

Python tkinter table widget for displaying tabular data
https://pypi.org/project/tksheet/
MIT License
408 stars 50 forks source link

Column header data not made when creating new columns #225

Closed MagnificentCreature closed 6 months ago

MagnificentCreature commented 6 months ago

I open an empty sheet with (empty) data [[]],

I do right click create new column, then I try to save.

However

print(self.sheet.get_header_data())

Does not do anything and I am unable to save the header data

Edit: also seems to throw a silent error, code bellow the print function doesnt run Edit 2: The error indicates I need to pass in a c (probably column) but even if I do so, nothing gets printed

ragardner commented 6 months ago

Hello,

Thanks very much for bringing this to my attention,

There's a few things going on here,

After examining the code which deals with inserting columns and rows I found that it was indeed an issue that it wasn't inserting header/row index cells upon inserting columns/rows

After making the necessary modifications and testing them a bit I found other issues that needed fixing involving similar functionality

Edit 2: The error indicates I need to pass in a c (probably column) but even if I do so, nothing gets printed

If you saw an empty line when printing that is probably intended. if either the header (sheet.MT._headers) wasn't long enough to cover the index you're printing or if it's an empty cell then in this case it would only print an empty string

To test this out you can do print(self.sheet.get_header_data(0, get_displayed=True)) which should print whatever the header is displaying instead of the underlying cell data

Of course there is the possibility that a silent error was being produced and blocking the printing, and you saw no new empty line, this may or may not be fixed now in 7.1.24

Anyway thanks again and here are the release notes:

Version 7.1.24

Fixed:

Changed:

Improved:

MagnificentCreature commented 6 months ago

Works now, thanks!