[Tkinter-discuss] Tkinter and Alt bindings

Russell Adams RLAdams at AdamsInfoServ.Com
Fri Feb 10 17:35:36 CET 2012

On Fri, Feb 10, 2012 at 04:45:20PM +0100, Michael Lange wrote:
> > Does this mean that when Alt_R is bound to anything, the Alt_L
> > behavior changes? Any why only for Tk?
> That's it! I just created a ~/.Xmodmap just like yours and after logging
> in again the odd Tk entry behavior is just the same here.

Great! I'm glad someone else can duplicate the behavior (finally!).

> About the reason I can only guess; since Tk apparently only knows about
> Alt, but does not differ Alt_L from Alt_R it maybe just takes whichever it
> gets and internally treats them both as "Alt".

I don't use Alt_R with Tk at all. Only Alt_L... I use Alt_R as mod4
which is the "windows key" modifier and that is bound to start
applications via hotkeys in the WM. One of my keyboards has no windows

> So if you remove your ~/.Xmodmap, is the issue then fixed?

If I don't alter Alt_R via xmodmap, yes it works. Now I'm trying to
determine why, because Alt_L works for everything else but Tk.

What I don't understand is why does setting Alt_R to a different
modifier change the behavior of Alt_L??

> I am not sure what exactly you want to achieve with your ~/.Xmodmap
> entries, probably something like to changing your Alt_R key into something
> like the AltGr key which I have here on my german keyboard instead?
> Anyway, maybe there is another solution possible which does not interfere
> with Tk. Here I found something which seems related, don't know if it
> helps you any though : https://bbs.archlinux.org/viewtopic.php?id=58145

That's really interesting... Great find!

xev reports my right Alt key as keycode 108 and reports as
ISO_Level3_Shift, it's a laptop keyboard. In my xmodmap I set that to
Alt_R and then set it to mod4.

I'll try the approach they document on the page and see if it works.


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!


> Regards
> Michael
> .-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.
> There comes to all races an ultimate crisis which you have yet to face
> .... One day our minds became so powerful we dared think of ourselves as
> gods.
> 		-- Sargon, "Return to Tomorrow", stardate 4768.3
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

Russell Adams                            RLAdams at AdamsInfoServ.com

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

More information about the Tkinter-discuss mailing list