I have created a tree inside a Canvas, and I have also allowed MouseWheel to scroll up and down.
However, how do I prevent scrolling if tree content has not exceed c
You can use the bbox
method of canvas to retrieve the actual height of drawn items on canvas. bbox
return a tuple defining a rectangle. You can compare it with the height of your canvas widget.
height = self.canvas.winfo_height()
_,_,_,items_height = self.canvas.bbox(Tkinter.ALL)
if (items_height < height):
direction = 0