Tkinter: bind Alt + mouse click

Ulrich Goertz ugoertz at
Sun Sep 29 09:32:34 EDT 2002


I am puzzled why I cannot bind events of the type "Alt" button press plus
mouse click. In other words, the following script which just opens a window
and should react on Alt-clicks by printing 'click', doesn't work for me:

# ---------------------------------
from Tkinter import *

def p(event): print 'click'

root = Tk()

f = Frame(root, width=100, height=100)
f.bind('<Alt-1>', p)

# ---------------------------------

(The window pops up, but nothing happens upon clicks.)

Everything works as expected if I replace <Alt-1> by <1>, <Control-1> or
<Shift-1>. I tried this on a Linux box with Python 2.0, 2.1 and 2.2, and
Tk 8.3. Any hints?


More information about the Python-list mailing list