List Info

Thread: Unbinding system keys (preventing F10 to activate the menu)




Unbinding system keys (preventing F10 to activate the menu)
country flaguser name
Germany
2007-04-11 02:02:41
Hi!

Under Windows XP, pressing F10 in a Tkinter application
actives the menu. I 
haven't found a way to unbind this events yet.

(I understand that system-wide events like Alt-Tab never
reach the application, 
but that's not the case for F10.)

Here is an example application



from Tkinter import *

root = Tk()
menu = Menu(root)
menu.add_cascade(label="File")
root.config(menu=menu)

def callback(event):
     print "pressed ", event.keysym, "
", event.keysym_num

canvas = Canvas(root, width=100, height=100)
canvas.pack()

root.unbind("<KeyPress-F10>")
root.unbind("<Key-F10>")
root.bind("<KeyPress>", callback)

root.mainloop()



Pressing F7 F8 F9 F10 F9 F8 F7 will show you what I mean.

(The same behavior occurs when there is no menu at all. In
this case, pressing 
F10 highlights the system menu (move, resize, ...), but does
not open it up.)

Thanks for your help

Martin
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discusspython.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )