Pmw.MenuBar hotkeys

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu Aug 1 07:00:23 EDT 2002


On Tuesday 30 Jul 2002 11:49 am, Martin Franklin wrote:
> On Tuesday 30 Jul 2002 8:35 am, Matthias Huening wrote:
> > Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com> wrote in
> >
> > news:mailman.1027968050.16442.python-list at python.org:
> > > On Monday 29 Jul 2002 6:23 pm, Matthias Huening wrote:
> > >> Hi,
> > >>
> > >> I seem unable to get the hotkeys to work with Pmw.MenuBar.
> > >> They should be activated with <ALT>+hotkey, but nothing happens...
> > >> When a menu is opened, the hotkeys of the different menu items do
> > >> work. The problem is only with the hotkeys on the menu bar. Any
> > >> ideas?
> > >>
> > >> Matthias
> > >
> > > Matthias,
> > >
> > > Have you got a small example?  I think I've had these working.....
> >
> > Okay, here is a minimal example.
> > (By the way: WinXP, Python 2.1, Pmw 0.8.5)
> >
> > Matthias
>
> This last bit on information is the problem (Windows!!!!)  I can get your
> example working on Linux without change but on windows (2000 in my case) I
> can't.  I dug around google but can't find a solution, idle uses Tkinter
> Menu's and it works there but I don't understand the code! Sorry I can;t be
> of more help
>
>
>
> Martin

Matthias,

OK so I took a closer look at some of my code that seems to work on both UNIX 
and Windows....  I do use Pmw but I don't use Pmw.MenuBar the following works 
for me on at least Linux and Windows (ME) I will test it on 2000 when I am 
next in the office.


from Tkinter import *

root=Tk()

menubar=Menu(root)
filemenu=Menu(menubar)
filemenu.add_command(label="Exit", command=root.quit, underline=1)
menubar.add_cascade(label='File', menu=filemenu, underline=0)

## I think this may be the problem in Pmw? 
## I can't see this sort of call in Pmw.MenuBar 
## 
root['menu']=menubar
root.mainloop()


Regards
Martin











More information about the Python-list mailing list