Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to disable mouse wheel in python tkinter with certain condition?

self.loginWindow.bind("<MouseWheel>",
                         lambda event: self.canvas.yview_scroll(int(-1 * (event.delta / 120)), "units"))

This was supposed to enable the scroll wheel in my tkinter project, but the problem is i want to stop that in a specific condition.
How to do that ?

I tried to make it this way

self.loginWindow.bind(None)

but it is not working

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can Try

if (anything):
   self.loginWindow.bind("<MouseWheel>",
                          lambda event: None)
else:
     (otherwise)

This will stop the mouse wheel events

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading