menu
index
/home/manager/prog-python/test_fundamentos/fundamentos/menu.py

                       Paquete fundamentos
  Conjunto de módulos para hacer entrada/salida sencilla en Python
 
                       Copyright (C) 2019
                 Universidad de Cantabria, SPAIN
                         Versión 1.1
                         Marzo 2019
 
 @author: Michael Gonzalez   <mgh@unican.es>
 
 Licencia: GPL
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
 License as published by the Free Software Foundation; either
 version 3 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
-----------------------------------------------------------------------
menu.py: Módulo con una clase que permite mostrar un menú con opciones
         en una ventana, y obtener la opción elegida por el usuario
-----------------------------------------------------------------------
 
--------------------
-- Ejemplo de uso --
--------------------
 
from fundamentos.menu import Menu
 
def main():
    menu_opciones = Menu("Elige una opción")
    menu_opciones.inserta_opcion("Editar ficha de cliente")
    ... otras opciones
    menu_opciones.inserta_opcion("Salir")
 
    terminar: bool = False
    while not terminar:
        resultado: str = menu_opciones.espera()
        ... trabajar con la opción elegida
        terminar = resultado.lower() in ("kill", "salir")
 
    menu_opciones.destruye()

 
Modules
       
time

 
Classes
       
builtins.object
Menu

 
class Menu(builtins.object)
    Menu(titulo: str)
 
Esta clase representa una ventana con un menú de opciones
 
  Methods defined here:
__init__(self, titulo: str)
Crea la ventana
 
Args:
    titulo: El título de la ventana
destruye(self)
Destruir la ventana
espera(self) -> str
Pinta la ventana y espera hasta que se pulsa OK
 
Returns:
    el texto "Kill" si se ha matado la ventana,
    o la etiqueta de la opción elegida
inserta_opcion(self, etiqueta: str)
Crea un botón para una nueva opción en el menú
 
Args:
    etiqueta: el texto que se colocará en el botón de la nueva opción

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        List = typing.List
N = 'n'