How to disable manual resizing of Tkinter's Treeview column?

前端 未结 3 364
陌清茗
陌清茗 2020-12-10 08:07

Since I can\'t horizontally scroll Treeview column due to what appears to be Tk/Tkinter limitation, I want to make it sticky so it is attached to the frame.

The issu

3条回答
  •  醉梦人生
    2020-12-10 08:36

    you can horizontally scroll treeview, when i rezize the colomns(at runtime, drag to the right 'off screen') the xscrollbar gets activated, 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)
    

提交回复
热议问题