How to create equal-width columns in Python 2.7 with Tkinter -


how can force columns in tkinter application window of equal width?

the tkdocs website states follows:

the width of each column (or height of each row) depends on width or height of widgets contained within column or row. means when sketching out user interface, , dividing rows , columns, don't need worry each column or row being equal width [or height, presumably].

http://www.tkdocs.com/tutorial/grid.html

but want columns equal width, preferably making width of all columns depend upon widest widget in any column. there way of achieving cleanly (i.e. not playing around cell padding until them same trial , error or arbitrarily assigning apparently adequate minimum width every column)? also, can selectively done some, not columns in grid (e.g. columns x and y are sized according widest widget in column x or y, column z sized according widest widget in column z)?

to make gridded layout have columns have same width, you've got configure columns have same weight , in same uniform group. configuration associated master widget, not of contained widgets (because columns can contain many widgets, of course).

in standard tk, done with:

# "fred" arbitrary key; means nothing other name group grid columnconfigure $master 0 -weight 1 -uniform fred 

in tkinter (note uniform seems not documented in docstring need):

# "fred" arbitrary key; means nothing other name group master.grid_columnconfigure(0, weight=1, uniform="fred") 

then repeat other column indices want set things for. (as can see, code's very similar in these 2 cases.)


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -