[repost] Embedding menus in frames prevents alt+key defaults?

Jeff Hobbs JeffH at ActiveState.com
Wed Jun 20 15:08:39 EDT 2001


Tim Christian wrote:
> 
> >>>>> "Tim" == Tim Christian <MrTJC at TimChristian.com> writes:
> 
>  Tim> Howdy, I'm learning how to use Python and Tkinter using Mark
>  Tim> Lutz' _Programming_Python_ (2nd edition) and have run into an
>  Tim> odd side effect.  It may be Tk specific (OT?), but I'll ask
>  Tim> here anyway.  Lutz discusses the relative merits of embedding
>  Tim> menus into top level windows versus frames.  The frames route
>  Tim> seems like a good idea for reusable objects.  However, after
>  Tim> I embed menus into frames, I notice that the menu items,
>  Tim> though underlined, are no longer selectable via the Alt key
>  Tim> (eg, Alt+F doesn't bring up the "File" menu, though the "F"
>  Tim> character is underlined).  Is this typical behavior?  Perhaps
>  Tim> it's just a problem under my development platform (Windows
>  Tim> 2000, Python 2.1)?

It seems like you might be using the old-style menus, because
that is what the frames route would require.  You can still
make "reusable" menus using the new menu mechanism (since 8.0).
You can see the code that is triggered with old-style menus in
the menu.tcl runtime library file.  The new-style ones are
native menus on Windows and Mac, so the OS will grab the Alt
key event when it needs to.

-- 
  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
        Tcl Support and Productivity Solutions



More information about the Python-list mailing list