Tkinter insert a Combobox inside a Treeview widget

懵懂的女人 提交于 2019-11-27 15:47:52

The treeview widget doesn't support embedded widgets. The values for the values attribute are treated as strings.

By default, a Treeview is a static display of a forest of lists of strings. However, with work, after carefully reading Treeview references, one can make a Treeview fairly interactive. For this question, I would bind left click to an event handler that compares the mouse x,y to the bounding box (.bbox) for the units attribute cell. If in the box, display a Combobox, initialized with the current value (such as 'flops'), directly on top of the units attribute cell.

Tkinter.ttk Treeview reference and Tcl/tk treeview reference

Of course, it might be easier to put the Treeview in a frame with with a separate Combobox.

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