Skip to content

Commit fb751aa

Browse files
committed
tkitner grid size
1 parent 83fc638 commit fb751aa

File tree

11 files changed

+82
-8
lines changed

11 files changed

+82
-8
lines changed

tkinter/grid-columnconfigure-rowconfigure/README.md

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ b.grid(column=2, row=2)
1212
root.mainloop()
1313
```
1414

15-
![#1](images/main-1.png?raw=true)
15+
![#1](images/main-01.png?raw=true)
1616

1717
---
1818

@@ -28,7 +28,7 @@ b.grid(column=2, row=2)
2828
root.mainloop()
2929
```
3030

31-
![#1](images/main-2.png?raw=true)
31+
![#1](images/main-02.png?raw=true)
3232

3333
---
3434

@@ -48,7 +48,7 @@ b.grid(column=2, row=2)
4848
root.mainloop()
4949
```
5050

51-
![#1](images/main-3.png?raw=true)
51+
![#1](images/main-03.png?raw=true)
5252

5353
---
5454

@@ -69,7 +69,7 @@ b.grid(column=2, row=2)
6969
root.mainloop()
7070
```
7171

72-
![#1](images/main-4.png?raw=true)
72+
![#1](images/main-04.png?raw=true)
7373

7474
---
7575

@@ -90,7 +90,7 @@ b.grid(column=2, row=2)
9090
root.mainloop()
9191
```
9292

93-
![#1](images/main-5.png?raw=true)
93+
![#1](images/main-05.png?raw=true)
9494

9595
---
9696

@@ -111,7 +111,7 @@ b.grid(column=2, row=2)
111111
root.mainloop()
112112
```
113113

114-
![#1](images/main-6.png?raw=true)
114+
![#1](images/main-06.png?raw=true)
115115

116116
---
117117

@@ -132,8 +132,82 @@ b.grid(column=2, row=2)
132132
root.mainloop()
133133
```
134134

135-
|with<br/>`geometry()`|without<br/>`geometry()`|
135+
| without<br/>`geometry()` | with<br/>`geometry('300x300')` |
136136
| --- | --- |
137-
| ![#1](images/main-5.png?raw=true) | ![#1](images/main-3.png?raw=true) |
137+
|![#1](images/main-03.png?raw=true) | ![#1](images/main-05.png?raw=true) |
138+
139+
---
140+
141+
```python
142+
import tkinter as tk
143+
144+
root = tk.Tk()
145+
root.minsize(width=600, height=0)
146+
147+
root.columnconfigure(1, minsize=50, weight=1)
148+
root.columnconfigure(3, minsize=50, weight=1)
149+
root.rowconfigure(1, minsize=50, weight=1)
150+
root.rowconfigure(3, minsize=50, weight=1)
151+
152+
b = tk.Button(root, text="Exit", command=root.destroy)
153+
b.grid(column=2, row=2)
154+
155+
root.mainloop()
156+
```
157+
158+
![#1](images/main-07.png?raw=true)
159+
160+
---
161+
162+
```python
163+
import tkinter as tk
164+
165+
root = tk.Tk()
166+
root.geometry('300x300')
167+
168+
root.columnconfigure(1, weight=1)
169+
root.columnconfigure(3, minsize=25) #weight=0
170+
root.rowconfigure(1, weight=1)
171+
root.rowconfigure(3, minsize=25) #weight=0
172+
173+
b = tk.Button(root, text="Exit", command=root.destroy)
174+
b.grid(column=2, row=2)
175+
176+
root.mainloop()
177+
```
178+
179+
| at start |
180+
| --- |
181+
| ![#1](images/main-08.png?raw=true) |
182+
183+
| resized (using mouse) |
184+
| --- |
185+
| ![#1](images/main-09.png?raw=true) |
186+
187+
---
188+
189+
```python
190+
import tkinter as tk
191+
192+
root = tk.Tk()
193+
root.geometry('800x50')
194+
195+
root.columnconfigure(1, weight=1)
196+
root.columnconfigure(2, weight=4)
197+
root.columnconfigure(3, weight=8)
198+
199+
b1 = tk.Button(root, text="Col 1")
200+
b1.grid(column=1, row=1, stick='we')
201+
202+
b2 = tk.Button(root, text="Col 2")
203+
b2.grid(column=2, row=1, stick='we')
204+
205+
b3 = tk.Button(root, text="Col 3")
206+
b3.grid(column=3, row=1, stick='we')
207+
208+
root.mainloop()
209+
```
210+
211+
![#1](images/main-10.png?raw=true)
138212

139213

Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)