Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long text getting truncated in table view #32

Open
Meandmore opened this issue Jul 8, 2018 · 8 comments
Open

Long text getting truncated in table view #32

Meandmore opened this issue Jul 8, 2018 · 8 comments

Comments

@Meandmore
Copy link

I'm attempting to get long text to appear in a cell. From the data file:

capture1

The text has embedded newlines (0x0a) which appear to work,

capture2

and the data appears to be going into the model correctly,

capture2

but (as seen in the second and third images) the displayed info is being truncated. Is there anything that can be done with that?

@dmnfarrell
Copy link
Owner

dmnfarrell commented Jul 11, 2018

It doesn't support wrapping as such. I think the truncation is done in the drawText method https://github.com/dmnfarrell/tkintertable/blob/master/tkintertable/Tables.py
I don't actively make updates to this library but if you can change it in a way that doesn't break normal behaviour I would be glad to integrate the code.

@Meandmore
Copy link
Author

Here's line 1634 [in drawText()]:
celltxt = celltxt[0:int(math.floor(newlength))]

There should be no trouble partitioning around newlines, but the height of the cell will now have to be considered. I haven't used tkintertable long enough -- is there only one row height for the whole table? If so, then either all rows might be height-increased; or the font size can be decreased; or the text is truncated but not until the height is filled. I suspect the first two are non-starters.

While not optimal for me, if the text can be extended that would be better than nothing. (BTW, I'm not suggesting an automatic wrap - the user would have to provide embedded newlines in the text to create multiple lines in the cell.)

Are you OK with any of those options?

@dmnfarrell
Copy link
Owner

Yes there is a single global row height and font size. These can be changed in the prefs dialog.
The text length is meant to be truncated to fit the column but seems isn't accurately calculated anyway. A proper wrap would be best rather than a hack based on newlines but I realise it would take time to implement. Any solution that doesn't break the normal behaviour is ok. You might be better off subclassing the table and implementing your own drawText that doesn't truncate.

Note that I implemented wrapping in pandastable but just for the column header ( http://dmnfarrell.github.io/dataexplore/2018/06/21/newrelease-0.10). So the code in there might be of use also. see https://github.com/dmnfarrell/pandastable/blob/master/pandastable/headers.py

@alex-pancho
Copy link

alex-pancho commented Feb 20, 2019

I download last version, but i have seems problem:
screen
Did you can help fix it?

@dmnfarrell
Copy link
Owner

The table can't deal with non ascii characters very well. You are using cyrilic? I'll have to see how easy it is to fix.

@alex-pancho
Copy link

alex-pancho commented Feb 22, 2019

it is unicode encoding, but yes, it is cyrillic.
or maybe its cp1251 -Widows Cyrillic

i have some other question about tkintertable, if you can help - it was amazing!
my e-mail is pan.pan.4it@gmail.com

@MRES1
Copy link

MRES1 commented Jul 27, 2020

I'm attempting to get long text to appear in a cell. From the data file:

capture1

The text has embedded newlines (0x0a) which appear to work,

capture2

and the data appears to be going into the model correctly,

capture2

but (as seen in the second and third images) the displayed info is being truncated. Is there anything that can be done with that?

I need to get values truncated otherwise it looks really bad for my purposes how did you make that happen?

image

@MRES1
Copy link

MRES1 commented Jul 27, 2020

The text length is meant to be truncated to fit the column but seems isn't accurately calculated anyway.

I think you know my problem ... what should be the solution to make this calculation more accurate?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants