質問するログイン新規登録

回答編集履歴

1

Fixed.

2021/04/05 17:43

投稿

FredericChang
FredericChang

スコア54

answer CHANGED
@@ -15,11 +15,11 @@
15
15
  self.win.rowconfigure(tuple(range(2)), weight=1)
16
16
  self.win.columnconfigure(tuple(range(2)), weight=1)
17
17
 
18
- columns = 5
18
+ columns = 10
19
19
  data = []
20
20
  for i in range(0, 100, 5):
21
21
  data.append([i, i+1, i+2, i+3, i+4])
22
- self.tree = ttk.Treeview(self.win, selectmode ='browse')
22
+ self.tree = ttk.Treeview(self.win, selectmode='browse')
23
23
  self.tree.grid(row=0, column=0, rowspan=2, columnspan=2, sticky="nsew", padx=5, pady=5)
24
24
  self.tree["columns"] = tuple(range(1, columns + 1))
25
25
  self.tree["show"] = "headings"
@@ -33,18 +33,13 @@
33
33
  self.verscrlbar = ttk.Scrollbar(self.win,
34
34
  orient="vertical",
35
35
  command=self.tree.yview)
36
+ self.verscrlbar.grid(row=0, column=2,rowspan=2, sticky="nsew")
37
+ self.hozscrlbar = ttk.Scrollbar(self.win,
38
+ orient="horizontal",
39
+ command=self.tree.xview)
36
- self.verscrlbar.grid(row=0, column=2, sticky="nsew")
40
+ self.hozscrlbar.grid(row=2, column=0, sticky="nsew")
37
- self.tree.configure(xscrollcommand=self.verscrlbar.set)
41
+ self.tree.configure(yscrollcommand=self.verscrlbar.set, xscrollcommand=self.hozscrlbar.set)
38
42
 
39
- # self.button1 = tk.Button(self.win, text="▲", command=self.push_button1)
40
- # self.button1.grid(row=0, column=2, sticky="nsew")
41
- # self.button2 = tk.Button(self.win, text="▼", command=self.push_button2)
42
- # self.button2.grid(row=1, column=2, sticky="nsew")
43
- # self.button3 = tk.Button(self.win, text="◀", command=self.push_button3)
44
- # self.button3.grid(row=2, column=0, sticky="nsew")
45
- # self.button4 = tk.Button(self.win, text="▶", command=self.push_button4)
46
- # self.button4.grid(row=2, column=1, sticky="nsew")
47
-
48
43
  def main():
49
44
  win = tk.Tk()
50
45
  App(win)