How To Use Horizontal Scrolling In Treeview,here I Use Tree View To Make A Table
Solution 1:
According to the screenshot it looks like your table hast not enough space provided by the root window. The scrollbar is probably there, but not visible since the table is cut at the rightside , so you need to adapt the properties of the geometry manager you use for the table's root window
Solution 2:
def CreateUI(self,headings):
tv = Treeview(self,height=20)
if(headings==None):
tv['columns'] = ('starttime', 'endtime', 'status')
else:
tv['columns'] = headings[1:]
tv.heading("#0", text=headings[0], anchor='w')
--> tv.column("#0", anchor="center",width=100,minwidth=100)
foriin headings[1:]:
tv.heading(i, text=i)
--> tv.column(i, anchor='center',width=90,minwidth=100)##
tv.pack(expand=Y)
self.treeview = tv
some edit in this function helped me through, thank you for those who tried. I used an extra parameter of the treeview i.e. , the minwidth. having a difference in width and min width will allow us to go through this issue.
Solution 3:
you can horizontally scroll treeview, rezize the colomns(at runtime, drag to the right 'off screen') the xscrollbar gets activated, OR resize the column (bigger) in you code using an event after creation of scrollbar and treeview, such as push of button(say when treeview gets filled), else '.xview' detects nothing
vsbx = tkinter.Scrollbar(root_search_stock, orient="horizontal")
vsbx.place(x= 40, y = 550, width = 1000)
tree = tkinter.ttk.Treeview(root_search_stock,\
columns=column_names,yscrollcommand=vsby.set,xscrollcommand=vsbx.set)
tree.place(x = 50, y = 300)
vsbx.config(command = tree.xview)
Post a Comment for "How To Use Horizontal Scrolling In Treeview,here I Use Tree View To Make A Table"