samedi 18 mai 2019

Binding multiple keys to a function in Tkinter Python

Say if i wish to bind my space bar and the key "w" to any random function in my code, how would i do this? Should i be using if "w" and if "" then perform or can you bind multiple keys to one function?

#if statement way. idk how to do this tho
if "w" == Pressed:
   if "<space>" == Pressed:
      #perform function

#or 
self._master.bind("<space>", "w", lambda e: function)

Aucun commentaire:

Enregistrer un commentaire