Skip to content
Advertisement

How to remove a keybind after it has done its job

I created a keybind, and want to delete it after it is activated. How do I do this?

I have tried this in my code:

JavaScript

However, this does not work, as Python displays an error message stating that deletecommand() takes 2 positional arguments but 3 were given, when I only gave two arguments. I also tried root.delete('<Key>', testing), but this also fails.

JavaScript

I was hoping that the program would remove the keybind after it did its job. However, Python displayed an error message, as mentioned before. How do I fix this problem?

Advertisement

Answer

try as this

JavaScript

For unbind all the widget use the function .unbind_all('<Key>').

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement