I've been trying to add a keyboard shortcut in Python 3 that activates a function.
from tkinter import *
from tkinter import messagebox
root = Tk()
def myThing():
messagebox.showinfo("Hi", "Hello")
root.bind_all("<control-m>", myThing)
root.mainloop()
But when I press control m, this comes:
sorry, the copy-paste doesn't work for the command prompt
But, when I do this:
from tkinter import *
from tkinter import messagebox
root = Tk()
def myThing(k):
print(k)
root.bind_all("<Control-m>", myThing)
root.mainloop()
It does this:
what am I doing wrong?
I know that there are questions like this online, but I tried all of them, and got that error. I asked this question because the answers weren't clear enough for me.
PS: This is python 3.5.2