回答編集履歴
1
背景色と余白を用いた罫線の実装、コードを追加
test
CHANGED
@@ -20,6 +20,66 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
+
追記
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
![イメージ説明](b7ba3972d1b2e5e38a1be72b4520b29e.png)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
```python
|
32
|
+
|
33
|
+
import tkinter as tk
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
border_color = "black"
|
38
|
+
|
39
|
+
grid_options = dict(padx=(1,0), pady=(1,0), sticky="nwse")
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
root = tk.Tk()
|
44
|
+
|
45
|
+
frame = tk.Frame(root, bg=border_color)
|
46
|
+
|
47
|
+
frame.pack(fill=tk.BOTH, expand=True)
|
48
|
+
|
49
|
+
frame.grid_columnconfigure(1, weight=True)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
bgcolor = root.cget("bg")
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
for row, num in enumerate([3, 6, 9]):
|
58
|
+
|
59
|
+
field = tk.Frame(frame, bg=bgcolor, relief=tk.SOLID)
|
60
|
+
|
61
|
+
label = tk.Label(field, text="a" * num)
|
62
|
+
|
63
|
+
label.pack(fill=tk.X, side=tk.LEFT)
|
64
|
+
|
65
|
+
field.grid(row=row, column=0, **grid_options)
|
66
|
+
|
67
|
+
entry = tk.Entry(frame)
|
68
|
+
|
69
|
+
entry.grid(row=row, column=1, **grid_options)
|
70
|
+
|
71
|
+
frame.grid_rowconfigure(row, weight=True)
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
root.mainloop()
|
76
|
+
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
23
83
|
----
|
24
84
|
|
25
85
|
他の方法
|