I am having trouble with this code:
The mod is the bit which I hoped would allow me to pick out a specific key so I could respond accordingly but it is ignored so I guess it's some sort of error.
Can you point me in the right direction please?
from tkinter import * root = Tk() def key(event): kp = repr(event.char) print ("pressed", kp) #repr(event.char)) if (kp == 'x'): print ("pressed x", repr(event.char)) def callback(event): frame.focus_set() print ("clicked at", event.x, event.y) frame = Frame(root, width=100, height=100) frame.bind("<Key>", key) frame.bind("<Button-1>", callback) frame.pack() root.mainloop()which is a modification of code from here:
Quote:http://effbot.org/tkinterbook/tkinter-ev...ndings.htm
The mod is the bit which I hoped would allow me to pick out a specific key so I could respond accordingly but it is ignored so I guess it's some sort of error.
Can you point me in the right direction please?