I have created a treeview that displays incoming messages. As the number of messages received exceeds the size of the treeview window, I use this line of code
self.logTree.yview_moveto(1)
to make sure the latest message is always displayed at the bottom of the window. However, I want to stop this behavior if the user scrolls up. I need a means for determining whether the last received message is displayed. How can I do this?
Thanks
You can use bbox()
to check whether an item of Treeview
is visible:
# get the iid of last item
last = tree.get_children()[-1]
# bbox() returns the bounding box of the item if it is visible
# otherwise it returns empty string
visible = tree.bbox(last) != ""