[Tkinter-discuss] Tkinter and Alt bindings

Russell Adams RLAdams at AdamsInfoServ.Com
Thu Feb 9 15:03:20 CET 2012

On Thu, Feb 09, 2012 at 11:22:47AM +0100, Michael Lange wrote:
> Hi,
> ##########
> entry .e
> grid .e -column 0 -row 0
> bind . <Alt-s> {puts "Alt-s pressed"}
> focus .e
> #########
> If you store this as test.tcl and then run it with $ wish test.tcl , is it
> the same as in your Python example?

Yes, Alt-s does not work. If I change it to Mod1, that triggers but
still adds "s" to the entry widget.

> Then, which window manager are you using, and can you try it with some
> other WM(s) , does the problem persist then?

I haven't had that opportunity, however I was debugging whether it was
an xmodmap issue.

My xmodmap output:
$ xmodmap
xmodmap:  up to 5 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
control     Control_L (0x25),  Control_L (0x42),  Control_R (0x69)
mod1        Alt_L (0x40),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod4        Alt_R (0x6c),  Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

This is really plain. The only change is Alt_R is bound to mod4. I'm
using the left Alt in my testing. At this point, I'm pretty sure its
not xmodmap.

Every other GUI app works fine with Alt. Emacs, Firefox, Pidgeon,
Dolphin, Urxvt, and the list goes on. If there had been a problem
anywhere else with Alt, I'd have immediately tracked it down as a
local configuration issue.

> Then, which version of Tk are you using, and, if your distribution offers
> this, can you try and install a second Tcl/Tk-version and try if it is the
> same with this one?

Ubuntu's TCL 8.5.8-2build1 and Tk 8.5.8-1.

No other, but I may be upgrading to the latest Ubuntu shortly.


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