[Tkinter-discuss] Tkinter and Alt bindings

Michael Lange klappnase at web.de
Sat Feb 11 12:38:43 CET 2012


Thus spoketh Russell Adams <RLAdams at AdamsInfoServ.Com> 
unto us on Fri, 10 Feb 2012 10:35:36 -0600:

> And it works! If I just set the keycode to Super_L, the Alt behavior
> works properly.
> I still don't understand why changing Alt_R changes the behavior of
> Alt_L, but that was exactly the problem. I'd love to figure it out,
> but I suspect its X11 weirdness. I had originally suspected it was
> related to Mod1/Alt handling
> I'll use this for now!

I'm glad I could help!
I think the problem is that Tk does not seem to differ between the two
Alt keys at all; from man bind:

" Similarly, the Alt modifier refers to whichever modifier is associated
with the alt key(s) on the keyboard (keysyms Alt_L and Alt_R). "

So obviously this has to be taken into account when changing xmodmap
behavior. I am not familiar with xmodmap at all, maybe just defining the
changes for "keysym" instead of "keycode" in ~/.Xmodmap helps (iirc
someone suggested this somewhere, I am not sure at all though).

It is just a guess, but maybe gtk and qt are aware of two different Alt
keys so the problem does not occur there.



.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Men will always be men -- no matter where they are.
		-- Harry Mudd, "Mudd's Women", stardate 1329.8

More information about the Tkinter-discuss mailing list