Tkinter: Figured Out Why Accelerator Keys Broken Under Win32

Tim Daneliuk tundra at tundraware.com
Tue Jan 7 23:00:07 CET 2003


I asked this question (poorly) a couple days ago, and now have more data to
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 "Commands"
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 Mod1
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 writing
manual accelerators triggered by the 0x20000 bit on Win32 (yuk!)?

TIA,
-- 
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com





More information about the Python-list mailing list