0

Necesito ocultar la columna "Fecha" para poder recorrer las columnas con un scrollbar horizontal y poder agregar mas columnas para recorrerlas con un scrollbar horizontal, aquí les dejo una foto del treeview:pantalla del treeview

el pedazo de codigo:

studentView=ttk.Treeview(miFrame3, height=3,columns=("#1","#2","#3","#4","#5","#6","7"))
studentView.grid(column=1,row=2)
studentView.heading('#0' , text="", anchor="w")
studentView.heading('#1' , text="up", anchor=CENTER)
studentView.heading('#2' , text="Nombre", anchor=CENTER)
studentView.heading('#3' , text="grupo", anchor=CENTER)
studentView.heading('#4' , text="carrera", anchor=CENTER,)
studentView.heading('#5' , text="hora etrada", anchor=CENTER)
studentView.heading('#6' , text="hora salida", anchor=CENTER)
studentView.heading('#7' , text="Fecha", anchor=CENTER)


studentView.column("#0",stretch=False, width=1)
studentView.column("#1",stretch=False, width=80)
studentView.column("#2",stretch=False, width=80)
studentView.column("#3",stretch=False, width=80)
studentView.column("#4",stretch=False, width=80)
studentView.column("#5",stretch=False, width=150)
studentView.column("#6",stretch=False, width=80)
studentView.column("#7",stretch=False, width=80)

el codigo para las scrollbar

esa es la vertical, que funciona correctamente

studentScrollBar=ttk.Scrollbar(miFrame3,orient="vertical",command=studentView.yview) studentView.configure(yscroll=studentScrollBar.set) studentScrollBar.grid(row=2,column=6,sticky="ns")

y la horizontal:

studentScrollBar2=ttk.Scrollbar(miFrame3,orient="horizontal",command=studentView.xview) studentView.configure(xscroll=studentScrollBar2.set) studentScrollBar2.grid(column=1)

3
  • Hola Daniel, bienvenido a Stack Overflow en español. Si lo he entendido bien, creo que tu problema real es que no has configurado correctamente la barra horizontal, no necesitas ocultar la columna esto se hece automlaticamente si el tamaño excede el establecido, si todo está bien configurado. ¿Podrias agregar el código dónde creas y configuras las barras?
    – FJSevilla
    el 12 mar. 2020 a las 9:35
  • Hola, muchas gracias, ahorita actualizo el codigo el 12 mar. 2020 a las 22:52
  • @FJSevilla ya actualice el codigo el 12 mar. 2020 a las 22:55

1 respuesta 1

0

Si mal no recuerdo, existe una funcion para mostrar solo algunas columnas.

self.tree["displaycolumns"]=("col1", "col2",...)

Donde:

self.tree = ttk.Treeview(self.master)

Con esto serias capaz de hacer lo que buscas.

De todos modos, esto esta sacado de otra respuesta algo mas antigua .

Espero que te sea de ayuda

1
  • Muchas gracias, dejame lo checo el 12 mar. 2020 a las 23:28

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.