Tkinter: Figured Out Why Accelerator Keys Broken Under Win32

v.wehren v.wehren at home.nl
Tue Jan 7 17:38:34 EST 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.

Vincent


"Tim Daneliuk" <tundra at tundraware.com> schrieb im Newsbeitrag
news:68ifva.f82.ln at boundary.tundraware.com...
> 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