Is it possible to scroll Treeview's column content, not column window in Tkinter?

两盒软妹~` 提交于 2019-12-11 01:13:55

问题


I have a window with Treeview widget and a column. If I add enough nodes so that node's text extends beyond window's width, it'll not be possible to scroll horizontally unless I change column width to make it wider than the window width.

Here's what I mean:

I should be able to scroll horizontally so I can accomodate for the node's text, but the horizontal scroll bar is disabled.

However, if I manully resize the column itself, I'll be able to scroll until I reach the column's right border.

Notice that scrollbar accomodates for the column width, not the text, the text was left behind.

self._tree_scrollbar_x = ttk.Scrollbar(self._tree_frame, orient='horizontal', command=self._tree.xview)
self._tree.configure(xscrollcommand=self._tree_scrollbar_x.set)
self._tree_scrollbar_x.grid(row=1, column=0, sticky=(tk.E, tk.W))

There is a resize property, but that only changes whether the column resizes automatically with the window frame/border.

I know this question has been asked before without a solid answer, so this just might be the limitation of Tkinter/Ttk.

Any help is greatly appreciated, thanks.

来源:https://stackoverflow.com/questions/45245725/is-it-possible-to-scroll-treeviews-column-content-not-column-window-in-tkinter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!