Tkinter: Figured Out Why Accelerator Keys Broken Under Win32

v.wehren v.wehren at
Tue Jan 7 23:38:34 CET 2003

Accelerators can work just fine on win32 in menus using *Menu* widgets. I'm
not entirely sure, but I remember reading somewhere that the Menubutton
widget was deprecated. Anyway, I know that mnemonics on Button windows
definitively don't  work on Windows. You you have to bind them extra.


"Tim Daneliuk" <tundra at> schrieb im Newsbeitrag
news:68ifva.f82.ln at
> I asked this question (poorly) a couple days ago, and now have more data
> ask it clearly:
> I have a Tkinter program which runs on both Unix and Win32.  On Unix,
> accelerator keys for my menus work fine.  I have one menu called
> and another called "Directories" and Alt-C and Alt-D bring them up
> respectively.  On Win32, pressing these keys does nothing.
> After some digging, I discovered that, under Unix, the Alt key sets the
> bit of the event.state value.  However, under Win32, the 0x20000 bit is
set (???)
> Presumably, the Tk core is looking for the Mod1 bit, which it never sees
> under Win32, hence the accelerators do not work.  (I would think that
> Tk itself should somehow remap this to make the Alt keypress consistent
> regardless of underlying platform differences.  No?)
> Has anyone seen this problem before?  Is there any workaround besides
> manual accelerators triggered by the 0x20000 bit on Win32 (yuk!)?
> TIA,
> --
> --------------------------------------------------------------------------
> Tim Daneliuk
> tundra at

More information about the Python-list mailing list