title: How to set width of Treeview in tkinter of python
body: <p>Recently, I use <code>tkinter</code> <code>TreeView</code> to show many columns in <code>Python</code>. Specifically, 49 columns data in a treeview. I use <code>grid</code> to manage my widgets.</p>
  
  <p>I found out the width of the treeview only depends on the width of columns.</p>
  
  <p>My question is, How can I set the width of the Treeview. (The default width is the summation of all columns' width)</p>
  
  <p>When all my column width is set as 20. This is 49 columns. :)
  <a href="https://i.stack.imgur.com/zvqmh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zvqmh.png" alt="enter image description here"></a></p>
  
  <p>Here is my main code :</p>
  
  <pre><code>frame = Frame(self.master, width = 1845, height = 670)
  frame.place(x = 20, y = 310)
  tree_view = Treeview(frame, height = 33, selectmode = "extended")
  for i in range(len(id_list)):
      tree_view.column(id_list[i], width = width_list[i], anchor = CENTER)
      tree_view.heading(id_list[i] , text = text_list[i])
  tree_view["show"] = "headings"
  # Omit the declaration of scrollbar    
  tree_view['yscroll'] = self.y_scollbar.set
  tree_view['xscroll'] = self.x_scollbar.set
  tree_view.grid(row = 0, column = 0, sticky = NSEW)
  for item in detail_info_list:
      tree_view.insert("",0, text = str(item.id), value=(...))
  </code></pre>
  
  <p><code>id_list</code>,<code>width_list</code>,<code>text_list</code> is used to store columns information.
  <code>detail_info_list</code> is to store the data showed in the Treeview.</p>
  
  <p>My target is when I define a large width(for example: 3000) of some column, my treeview could show the data as I expected. But the treeview is across my screen and the horizontal scrollbar also can't slide.</p>
  
  <p>When 17th column is set as 1500:
  <a href="https://i.stack.imgur.com/A3rOb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A3rOb.png" alt="enter image description here"></a></p>
  
  <p>I can't see my buttons, and I can't slide the horizontal scrollbar.</p>
  
  <p>Also, I have tried some solution.</p>
  
  <ul>
  <li>Define a frame to be the Treeview parent. And define the width and height to constraint the Treeview. But it didn't work.</li>
  <li>I looked up some documents and search for this question. I don't find any solution to set the width as a constant number.</li>
  </ul>