I am programming a machine that gives shifts for meat, fish and fruit in a supermarket. I have 2 modules, numbers.py and main. In numeros.py is the code of a function decorator and three generators. In principal.py is where are the functions that manage the program.
I run the program and when I select one of the areas (meat, fish or fruit) the corresponding turn appears but not the wrapper I want to give it.
How can I do so that the wrapper is shown on the screen together with the shift?
**numeros.py**
# Decorator
def decorador(funcion):
def envoltorio_funcion():
print('Su turno es: ')
resultado = funcion()
print('Aguarde y será atendido.')
return resultado
return envoltorio_funcion
# Generators
# Generador de turnos de carne
@decorador
def generador_carne():
num = 1
while True:
yield f'C-{num}'
num += 1
generador_carne = generador_carne()
# Genenrador de turnos de pescado
def generador_pescado():
num = 1
while True:
yield f'P-{num}'
num += 1
generador_pescado = generador_pescado()
# Generador de turnos de fruta
def generador_fruta():
num = 1
while True:
yield f'F-{num}'
num += 1
generador_fruta = generador_fruta()
**principal.py**
# Módulo de funciones que administran el funcionamiento del programa
# Importar el contenido de numeros.py para poder disponer de sus funciones
import numeros
from os import system
# Preguntar al cliente a qué área desea dirigirse
def menu():
opcion = int(input('¿Para qué área desea sacar su turno?\\n'
'\[1\] - Carne\\n'
'\[2\] - Pescado\\n'
'\[3\] - Fruta\\n'
'Por favor, introduzca su respuesta: '))
# Dar un número de turno según el área al que se dirija
if opcion == 1:
print(next(numeros.generador_carne))
elif opcion == 2:
print(next(numeros.generador_pescado))
elif opcion == 3:
print(next(numeros.generador_fruta))
# Invocar a la función menu
menu()
# Preguntar al cliente si desea sacar otro turno y repetir el proceso
otro_turno = input('¿Desea sacar otro turno? \[S/N\]')
# Mientras que la respuesta sea Sí debe de continuar ejecutándose el menú
while otro_turno.lower() == 's':
# Limpiar la consola
system('cls')
# Invocar la función menu
menu()
# Preguntar al cliente si desea sacar otro turno
otro_turno = input('¿Desea sacar otro turno? \[S/N\]')