回答編集履歴
2
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`Treev
|
1
|
+
`Treeview` 用の frame は `grid()` メソッドで配置していますが、`Treeview` や `Scrollbar` は `pack()` メソッドを使用しています。なので、`self.tree_frame.pack_propagate(False)` を追加するとよいかと思います。
|
2
2
|
```python
|
3
3
|
# Treeviewフレーム
|
4
4
|
self.tree_frame = ttk.Frame(root, width=800, height=300) # フレームのサイズを調整
|
1
test
CHANGED
@@ -6,4 +6,13 @@
|
|
6
6
|
# 追加
|
7
7
|
self.tree_frame.pack_propagate(False)
|
8
8
|
```
|
9
|
+
それから、`self.tree.column()` に `stretch=False` を追加します。これは、列の幅を変更した際に横スクロールバーの幅が frame の幅に合わせられてしまうのを防ぐためです。
|
10
|
+
```python
|
11
|
+
# カラムの設定
|
12
|
+
columns = ["customer_id", "name_kanji", "name_katakana", "pet_kind", "pet_name", "pet_name_katakana", "pet_birth", "pet_sex", "telephone_number", "cellphone_number", "adress"]
|
13
|
+
for col in columns:
|
14
|
+
self.tree.heading(col, text=col)
|
15
|
+
# stretch=False を追加
|
16
|
+
self.tree.column(col, width=100, anchor="center", stretch=False) # 列の幅を設定
|
17
|
+
```
|
9
18
|

|