What's new

Python Horizontal scrollbar sa tkinter

ribbit

Eternal Poster
Established
ask ko lang po mga sir baka po alam niyo mag lagay nang horizontal scrollbar sa TreeView, na try ko na din po yung xview di nagana mga sir

eto po code ko sa sa Treeview sa tkinter

Python:
defult_tab_color = "#81B1D4"
select_tab_color = "#9BB4EB"
style = ttk.Style()

style.theme_use("clam")

style.configure("Treeview",
        background="#808080",
        foreground="#BFBFBF",
        fieldbackground="#E6E6E6")

scrollbarx = Scrollbar(frametable,orient=HORIZONTAL)
scrollbary = Scrollbar(frametable,orient=VERTICAL)

tree = ttk.Treeview(frametable, selectmode ='browse', height=24,xscrollcommand=scrollbarx.set)
tree["columns"] = ("1", "2", "3","4","5","6","7","8","9","10","11","12","13")
tree['show'] = 'headings'
tree.place(x=5, y=14)

tree.heading("1", text ="NAME")
tree.heading("2", text ="CONTACTS")
tree.heading("3", text ="GENDER")
tree.heading("4", text ="JOB")
tree.heading("5", text ="RPH")
tree.heading("6", text ="HPD")
tree.heading("7", text ="NODW")
tree.heading("8", text ="TAX")
tree.heading("9", text ="PHILHEALTH")
tree.heading("10", text ="SSS")
tree.heading("11", text ="GROSS SALARY")
tree.heading("12", text ="DEDUCTION")
tree.heading("13", text ="NET SALARY")

tree.column("1", width = 150, anchor ='c')
tree.column("2", width = 80, anchor ='c')
tree.column("3", width = 70, anchor ='c')
tree.column("4", width = 50, anchor ='c')
tree.column("5", width = 55, anchor ='c')
tree.column("6", width = 43, anchor ='c')
tree.column("7", width = 48, anchor ='c')
tree.column("8", width = 50, anchor ='c')
tree.column("9", width = 100, anchor ='c')
tree.column("10", width = 105, anchor ='c')
tree.column("11", width = 110, anchor ='c')
tree.column("12", width = 110, anchor ='c')
tree.column("13", width = 105, anchor ='c')

scrollbary = Scrollbar(frametable,orient=VERTICAL)
scrollbary.place(x=675,y=15,height=505)
scrollbary.config(command=tree.yview)
tree.config(yscrollcommand=scrollbary.set)

scrollbarx=Scrollbar(frametable, orient=HORIZONTAL)
scrollbarx.place(x=5,y=505,width=670)
scrollbarx.config(command=tree.xview)
 
Back
Top