- Tkinter GUI Programming by Example
- David Love
- 370字
- 2021-08-27 18:49:07
grid
The grid—as the name suggests—treats the parent widget as a grid containing rows and columns of cells. If you are familiar with spreadsheet software, grid will work in the same way. The grid lines will not be visible, they are just conceptual.
To specify the position within the grid, the row and column keywords are used. These accept integer values and begin at 0, not 1. A widget placed with grid(row=0, column=0) will be to the left of a widget at grid(row=0, column=1). Underneath these would sit a widget placed at grid(row=1, column=0).
To make a widget span more than one cell, use columnspan for a horizontal size increase and rowspan for a vertical increase. So, to make our hypothetical bottom widget sit below both, the full argument set would be grid(row=1, column=0, columnspan=2).
By default, a widget will sit in the center of its assigned cell(s). In order to make the widget touch the very edge of its cell, we can use the sticky argument. This argument takes any number of four constants: N, S, E, and W. These are abbreviations for North, South, East, and West. Passing in W or E will align the widget to the left or right, respectively. S and N will align to the bottom and top.
These constants can be combined as desired, so NE will align top right and SW will sit the widget bottom left.
If you wish for the widget to span the entire vertical space, use NS. Similarly, use EW to stretch to the full size in the horizontal direction.
If you instead want the widget to fill the whole cell edge to edge, NSEW will let you do this.
- Node.js Design Patterns
- 征服RIA
- Reactive Programming With Java 9
- Microsoft System Center Orchestrator 2012 R2 Essentials
- 正則表達式經(jīng)典實例(第2版)
- Gradle for Android
- Highcharts Cookbook
- JavaScript應(yīng)用開發(fā)實踐指南
- Java Web開發(fā)實例大全(基礎(chǔ)卷) (軟件工程師開發(fā)大系)
- Python數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南(全彩)
- Visual Basic語言程序設(shè)計基礎(chǔ)(第3版)
- Instant GLEW
- Elasticsearch Blueprints
- 數(shù)據(jù)結(jié)構(gòu):Python語言描述
- 軟件測試技術(shù)