Tkinter Treeview: set column widths
up vote
-1
down vote
favorite
I have a treeview with lots of columns and data, some numbers with fixed #commas, some warning symbols, some text that can be cut, some text that shouldn't be cut etc.
In short: I need and want to manually specify widths column by column.
My current approach is this one:
DEF_TreeHeaders = ['id','pos','time', ...]
DEF_TreeAlign = [L, L, R, ...]
DEF_TreeWidth = [0, 5, 10, ...]
for i in [..]:
treeView.column(i, width= DEF_TreeWidth[i], ...)
Seems width is not really absolute and also depends from the overall width of treeView. Trying everything through is time consuming and doesn't lead to the optimal solution.
So my idea is to let the python script run, adjust the columns manually and then print out the current widths, freeze them and store them in a config file.
Good idea? I am sure I am not the only one having had this problem. How have you handled it? How to set absolute width no matter what?
python tkinter treeview
add a comment |
up vote
-1
down vote
favorite
I have a treeview with lots of columns and data, some numbers with fixed #commas, some warning symbols, some text that can be cut, some text that shouldn't be cut etc.
In short: I need and want to manually specify widths column by column.
My current approach is this one:
DEF_TreeHeaders = ['id','pos','time', ...]
DEF_TreeAlign = [L, L, R, ...]
DEF_TreeWidth = [0, 5, 10, ...]
for i in [..]:
treeView.column(i, width= DEF_TreeWidth[i], ...)
Seems width is not really absolute and also depends from the overall width of treeView. Trying everything through is time consuming and doesn't lead to the optimal solution.
So my idea is to let the python script run, adjust the columns manually and then print out the current widths, freeze them and store them in a config file.
Good idea? I am sure I am not the only one having had this problem. How have you handled it? How to set absolute width no matter what?
python tkinter treeview
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have a treeview with lots of columns and data, some numbers with fixed #commas, some warning symbols, some text that can be cut, some text that shouldn't be cut etc.
In short: I need and want to manually specify widths column by column.
My current approach is this one:
DEF_TreeHeaders = ['id','pos','time', ...]
DEF_TreeAlign = [L, L, R, ...]
DEF_TreeWidth = [0, 5, 10, ...]
for i in [..]:
treeView.column(i, width= DEF_TreeWidth[i], ...)
Seems width is not really absolute and also depends from the overall width of treeView. Trying everything through is time consuming and doesn't lead to the optimal solution.
So my idea is to let the python script run, adjust the columns manually and then print out the current widths, freeze them and store them in a config file.
Good idea? I am sure I am not the only one having had this problem. How have you handled it? How to set absolute width no matter what?
python tkinter treeview
I have a treeview with lots of columns and data, some numbers with fixed #commas, some warning symbols, some text that can be cut, some text that shouldn't be cut etc.
In short: I need and want to manually specify widths column by column.
My current approach is this one:
DEF_TreeHeaders = ['id','pos','time', ...]
DEF_TreeAlign = [L, L, R, ...]
DEF_TreeWidth = [0, 5, 10, ...]
for i in [..]:
treeView.column(i, width= DEF_TreeWidth[i], ...)
Seems width is not really absolute and also depends from the overall width of treeView. Trying everything through is time consuming and doesn't lead to the optimal solution.
So my idea is to let the python script run, adjust the columns manually and then print out the current widths, freeze them and store them in a config file.
Good idea? I am sure I am not the only one having had this problem. How have you handled it? How to set absolute width no matter what?
python tkinter treeview
python tkinter treeview
edited Nov 9 at 11:03
martineau
64.7k887173
64.7k887173
asked Nov 9 at 10:50
VengaVenga
2515
2515
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18
add a comment |
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224278%2ftkinter-treeview-set-column-widths%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of How to change ttk.Treeview column width and weight in Python 3.3
– stovfl
Nov 9 at 14:49
Thanks, part (1) "hard wire width" is done by now and I like my approach for setting width = 100 more: treeView.column("Column 1", minwidth= 100, width= 100) Also very useful is to specify font and row height: style = ttk.Style() style.configure("Treeview", rowheight= 18, font= ('Helvetica', 9))
– VengaVenga
Nov 9 at 15:18