[Tutor] Disable menubar

Alberto Troiano albertito_g at hotmail.com
Thu May 19 22:04:17 CEST 2005


Hey everyone

I've read about menubars and I decided to use the MenuBar from PMW instead 
of Tkinter's

The reason is that I couldn't find an example to make a menu with cascade 
submenus and another cascade submenu inside the submenu and so on.

Now I want to ask if somebody knows how to accomplish these with Menu from 
TKinter?

On the other hand, every button on the menu opens a Toplevel, but I want to 
restrict the Toplevels to one of each kind. I was thinking in disable the 
menubutton but PMW only has disable_all and I only want to disable the 
opened Toplevel. Is there another way to accomplish this using Menu from 
TKinter or MenuBar from PMW or any other option?

I'm sending a copy of the code of the menu (If you think you'll need all the 
code tell me because is kind of long and has many things that I haven't 
tried yet)

Thanks in advanced

Alberto

def menuc():
    balloon = Pmw.Balloon(root)
    menuBar = Pmw.MenuBar(root,hull_relief = 'raised',hull_borderwidth = 
1,balloon = balloon)
    menuBar.pack(fill = 'x')
    menuBar.addmenu('Archivo', 'Salir')
    menuBar.addmenuitem('Archivo', 'command', 'Salir de la 
aplicacion',command = root.destroy,label = 'Salir')
    menuBar.addmenu('Parametros', 'Define ciudades y otros paramtros')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar ciudades',command=city,label='Ciudades')
    menuBar.addmenuitem('Parametros', 'separator')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar hospitales',command=hello,label='Hospitales')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar pacientes',command=hello,label='Pacientes')
    menuBar.addmenuitem('Parametros', 'separator')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar especialidades',command=hello,label='Especialidades')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar medicos',command=hello,label='Medicos')
    menuBar.addmenuitem('Parametros', 'separator')
    menuBar.addmenuitem('Parametros', 'command', 'Agregar, modificar o 
eliminar tecnicos',command=hello,label='Tecnicos')
    menuBar.addmenuitem('Parametros', 'separator')
    menuBar.addcascademenu('Parametros', 'Marcapasos','Marcas y modelos', 
traverseSpec = 'z', tearoff = 0)
    menuBar.addmenuitem('Marcapasos', 'command', 'Agregar, modificar o 
eliminar marcas',command=hello,label='Marcas')
    menuBar.addmenuitem('Marcapasos', 'command', 'Agregar, modificar o 
eliminar modelos',command=hello,label='Modelos')
    menuBar.addcascademenu('Parametros', 'Electrodos','Marcas y modelos', 
traverseSpec = 'z', tearoff = 0)
    menuBar.addmenuitem('Electrodos', 'command', 'Agregar, modificar o 
eliminar marcas',command=hello,label='Marcas')
    menuBar.addmenuitem('Electrodos', 'command', 'Agregar, modificar o 
eliminar modelos',command=hello,label='Modelos')
    menuBar.addmenu('Implantes', 'Programacion de implantes')
    menuBar.addmenuitem('Implantes', 'command', 'Agregar, modificar o 
eliminar implantes',command=hello,label='Nuevo')
    menuBar.addmenuitem('Implantes', 'command', 'Generar 
reportes',command=hello,label='Reporte')
    menuBar.addmenu('Reprogramaciones', 'Programacion de reprogramaciones')
    menuBar.addmenuitem('Reprogramaciones', 'command', 'Agregar, modificar o 
eliminar reprogramaciones',command=hello,label='Nuevo')
    menuBar.addmenuitem('Reprogramaciones', 'command', 'Generar 
reportes',command=hello,label='Reporte')




More information about the Tutor mailing list