I want to create multiline HotKeys in python with one single for loop. I have a list looking like this:
import keyboard
HotKey = []
while True:
list = []
key = input()
word = input()
list .append(key,word)
if key == -1:
break
else:
HotKey.append(list)
for list in HotKey:
keyboard.add_hotkey(list[0], lambda: print(list[1]))
my 2 issues are:
- the list is not fixed and both of her lengh and keys can changed ny the user input.
- when Im using a for loop and using for loop and the function:
keyboard.addhotkey(TheKey, lambda: print(customWord)
whenever I will press any of those keys I added as hotkeys, this will print the word from the last hotkey in my list
Im looking for a way to fix it with/without for loop