def __init__(self, parent, title): super().__init__(parent, title= title) self.Center() self.controlador = Controlador() panel1= wx.Panel(self) self.l_autor= wx.StaticText(panel1, -1, 'Autor:') self.in_autor= wx.TextCtrl(panel1, -1) self.in_autor.SetFocus() self.l_titulo = wx.StaticText(panel1, -1, 'Título:') self.in_titulo= wx.TextCtrl(panel1) self.l_horas= wx.StaticText(panel1, -1, 'Horas') self.in_horas= wx.SpinCtrl(panel1) self.in_horas.SetRange(0,24) self.l_minutos= wx.StaticText(panel1, -1, 'Minutos') self.in_minutos= wx.SpinCtrl(panel1) self.in_minutos.SetRange(0,59) self.l_segundos= wx.StaticText(panel1, -1, 'Segundos') self.in_segundos= wx.SpinCtrl(panel1) self.in_segundos.SetRange(0,59) self.l_marcos= wx.StaticText(panel1, -1, 'Marcos') self.in_marcos= wx.SpinCtrl(panel1) self.in_marcos.SetRange(0,74) self.bt_reproducir= wx.Button(panel1, -1, '&Reproducir') #self.Bind(wx.EVT_BUTTON, Programa.reproducir_pausar, self.bt_reproducir) self.bt_aceptar= wx.Button(panel1, wx.ID_OK, '&Aceptar') self.bt_cancelar= wx.Button(panel1, wx.ID_CANCEL, '&Cancelar') self.getTiempo()
def inputsUsuario(): qTipoCruzamento = [ "Qual o tipo de cruzamento, ponto ou uniforme? (p / u) \n", Constantes.tipoCruzamento ] qUtilizaElitsmo = [ "Possui elitismo? (s / n) \n", Constantes.temElitismo ] qSelecaoRoletaOuTorneio = [ "Tipo de seleção: Roleta ou Torneio de 2 individuos? (r / t) \n", Constantes.tipoSelecao ] qTipoMutacao = [ "Qual o tipo de mutação, aleatória ou bit a bit? (a / b) \n", Constantes.tipoMutacao ] qProbabilidaCruzamento = [ "Qual a probabilidade de cruzamento? (0 a 100) \n", Constantes.taxaCruzamento ] qProbabilidaMutacao = [ "Qual a probabilidade de mutacao? (0 a 100) \n", Constantes.taxaMutacao ] qNumeroDeIndividuos = [ "Qual o numero de individuos? (somente número inteiro) \n", Constantes.numeroIndividuos ] qNumeroGeracao = [ "Qual o numero de gerações? (somente número inteiro) \n", Constantes.numeroGeracao ] qEnsaio = ["Qual o numero do ensaio ?", Constantes.ensaio] qNumeroExecucao["Quantas execuções ?", Constantes.numeroExecucao] rTipoCruzamento = input(qTipoCruzamento[0]) rUtilizaElitismo = input(qUtilizaElitsmo[0]) rSelecaoRoletaOuTorneio = input(qSelecaoRoletaOuTorneio[0]) rTipoMutacao = input(qTipoMutacao[0]) rProbabilidadeMutacao = input(qProbabilidaMutacao[0]) rProbabilidadeCruzamento = input(qProbabilidaCruzamento[0]) rNumeroIndividuos = input(qNumeroDeIndividuos[0]) rNumeroGeracao = input(qNumeroGeracao[0]) rEnsaio = input(qEnsaio) rNumeroExecucao = input(qNumeroExecucao) HasMapEscolhasUsuario = { qTipoCruzamento[1]: rTipoCruzamento, qUtilizaElitsmo[1]: rUtilizaElitismo, qSelecaoRoletaOuTorneio[1]: rSelecaoRoletaOuTorneio, qTipoMutacao[1]: rTipoMutacao, qProbabilidaCruzamento[1]: rProbabilidadeCruzamento, qProbabilidaMutacao[1]: rProbabilidadeMutacao, qNumeroDeIndividuos[1]: rNumeroIndividuos, qNumeroGeracao[1]: rNumeroGeracao, qEnsaio[1]: rEnsaio, qNumeroExecucao[1]: rNumeroExecucao } Controlador.inicializarOtimizacao(HasMapEscolhasUsuario)
def init(top, gui, *args, **kwargs): global w, top_level, root, controlador w = gui top_level = top root = top controlador = Controlador(gui=w) controlador.configurar_gui()
def main(): objenc = ObjectEncoder("datos.json") vista = Vista() ctrl = Controlador(vista, objenc) vista.setControlador(ctrl) ctrl.iniciar() ctrl.guardar()
class Editar(wx.Dialog): def __init__(self, parent, title): super().__init__(parent, title= title) self.Center() self.controlador = Controlador() panel1= wx.Panel(self) self.l_autor= wx.StaticText(panel1, -1, 'Autor:') self.in_autor= wx.TextCtrl(panel1, -1) self.in_autor.SetFocus() self.l_titulo = wx.StaticText(panel1, -1, 'Título:') self.in_titulo= wx.TextCtrl(panel1) self.l_horas= wx.StaticText(panel1, -1, 'Horas') self.in_horas= wx.SpinCtrl(panel1) self.in_horas.SetRange(0,24) self.l_minutos= wx.StaticText(panel1, -1, 'Minutos') self.in_minutos= wx.SpinCtrl(panel1) self.in_minutos.SetRange(0,59) self.l_segundos= wx.StaticText(panel1, -1, 'Segundos') self.in_segundos= wx.SpinCtrl(panel1) self.in_segundos.SetRange(0,59) self.l_marcos= wx.StaticText(panel1, -1, 'Marcos') self.in_marcos= wx.SpinCtrl(panel1) self.in_marcos.SetRange(0,74) self.bt_reproducir= wx.Button(panel1, -1, '&Reproducir') #self.Bind(wx.EVT_BUTTON, Programa.reproducir_pausar, self.bt_reproducir) self.bt_aceptar= wx.Button(panel1, wx.ID_OK, '&Aceptar') self.bt_cancelar= wx.Button(panel1, wx.ID_CANCEL, '&Cancelar') self.getTiempo() def getAutor(self): return self.in_autor.GetValue() def getTitulo(self): return self.in_titulo.GetValue() def getTiempoInicio(self): return (self.in_horas.GetValue(), self.in_minutos.GetValue(), self.in_segundos.GetValue(), self.in_marcos.GetValue()) def alertar(self): if self.in_autor.GetValue() == '': wx.MessageBox('Debes ingresar un autor.', 'Alerta.') elif self.in_titulo.GetValue() == '': wx.MessageBox('Debe ingresar un título.', 'Alerta.') def getTiempo(self): tiempo = self.controlador.cargar_tiempo() self.in_marcos.SetValue(tiempo[3]) self.in_segundos.SetValue(tiempo[2]) self.in_minutos.SetValue(tiempo[1]) self.in_horas.SetValue(tiempo[0])
def __init__(self, sys_argv, port): """Constructor de la clase, crea todo lo necesario para empezar el proyecto """ super(Chat, self).__init__(sys_argv) self.cliente = Cliente('0.0.0.0', port) self.controlador = Controlador(self.cliente) self.igchat = GUIChat(self.controlador, self.cliente) self.cliente.seConecto() t1 = threading.Thread(target=self.cliente.enviado) t1.setDaemon(True) t1.start() time.sleep(0.001) self.igchat.show()
def inputsUsuarioComParametros(rTipoCruzamento, rUtilizaElitismo, rSelecaoRoletaOuTorneio, rTipoMutacao, rProbabilidadeMutacao, rProbabilidadeCruzamento, rNumeroIndividuos, rNumeroGeracao, rEnsaio, rNumeroExecucao=100): HasMapEscolhasUsuario = { Constantes.tipoCruzamento: rTipoCruzamento, Constantes.temElitismo: rUtilizaElitismo, Constantes.tipoSelecao: rSelecaoRoletaOuTorneio, Constantes.tipoMutacao: rTipoMutacao, Constantes.taxaCruzamento: rProbabilidadeCruzamento, Constantes.taxaMutacao: rProbabilidadeMutacao, Constantes.numeroIndividuos: rNumeroIndividuos, Constantes.numeroGeracao: rNumeroGeracao, Constantes.ensaio: rEnsaio, Constantes.numeroExecucao: rNumeroExecucao } Controlador.inicializarOtimizacao(HasMapEscolhasUsuario)
def __init__(self): """ Inicia los componentes """ root = Tk() frame = Frame(root, height=500) frame.pack(fill=BOTH, expand=1) b_lateral = Frame(frame, width=150, height=500, bg="#dedede") b_lateral.pack(side=LEFT, fill=BOTH) canvas = Canvas(frame, bg="#000000", width=600, height=500) canvas.pack(side=LEFT, fill=BOTH, expand=1) controlador = Controlador(root, canvas, None) controlador.crear_barra(b_lateral) menu = Menu(root, tearoff=0) #se asocia el evento doble click canvas.bind("<Double-Button-1>", controlador.doble_click_izquierdo) canvas.bind("<Button-3>", lambda event: controlador.create_pop_menu(event, menu)) #se inicia la interfaz c < root.mainloop()
def __init__(self,parent, **kwds): kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, parent, size=(800,600), **kwds) self.parent=parent lista=[] self.consulta=Consultas() self.controlador=Controlador() lista=self.consulta.lista(lista) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("ID")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.text_ctrl_1.SetMaxLength(2) self.text_ctrl_1.Bind(wx.EVT_TEXT_ENTER,self.control_id) self.label_2 = wx.StaticText(self, wx.ID_ANY, _("NOMBRE")) self.combo_box_1 = wx.ComboBox(self, wx.ID_ANY, choices=lista, style=wx.CB_SIMPLE) self.label_3 = wx.StaticText(self, wx.ID_ANY, _("CANTIDAD: ")) self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.button_1 = wx.Button(self, wx.ID_ANY, _("INGRESAR")) self.Bind(wx.EVT_BUTTON,self.boton_ingresar,self.button_1) self.button_2 = wx.Button(self, wx.ID_ANY, _("FACTURAR")) self.Bind(wx.EVT_BUTTON,self.boton_facturar,self.button_2) self.grid_1 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1)) self.label_4 = wx.StaticText(self, wx.ID_ANY, _("TOTAL : ")) self.text_ctrl_3 = wx.TextCtrl(self, wx.ID_ANY, "0") self.label_5 = wx.StaticText(self, wx.ID_ANY, _("PAGA CON : ")) self.text_ctrl_4 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.label_6 = wx.StaticText(self, wx.ID_ANY, _("VUELTO : ")) self.text_ctrl_5 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER,self.limpiar_todo,self.text_ctrl_5) self.button_3 = wx.Button(self, wx.ID_ANY, _(u"ATR\xc1S")) self.Bind(wx.EVT_BUTTON, self.boton_atras,self.button_3) self.button_4 = wx.Button(self, wx.ID_ANY, _("SALIR")) self.Bind(wx.EVT_BUTTON, self.boton_salir,self.button_4) self.__set_properties() self.__do_layout() self.text_ctrl_1.SetFocus()
from socio import Socio from controlador import Controlador from datetime import datetime con = Controlador() while True: print("El numero total de socios es ", con.getNumSocios()) print("1.- Alta Socio") print("2.- Baja Socio") print("3.- Listar Socios") print("4.- Registrar Producto") print("5.- Actualizar Saldo") print("6.- Ficha de socio") print("7.- Salir") op = int(input("Selecciona una opcion: ")) if op == 1: while True: try: idsocio = int(input("Introduce el id del Socio: ")) socioExsiste = con.existeSocio(idsocio) if socioExsiste == True: print("----------------------------") print("Ya exsiste el Id del socio!!") print("----------------------------") else: break
from factura import Factura from controlador import Controlador from datetime import datetime controlador = Controlador() while True: print("**********MENU**********") print("Actualmente hay ", controlador.numFacturas(), " registradas") print("1.- Añadir Factura") print("2.- Listar Facturas Pendientes de Pago") print("3.- Listar Facturas Pagadas") print("4.- Pagar Factura") print("5.- Salir") while True: try: op = int(input("Introduce una opción: ")) if op <= 5 and op >= 1: break else: print("Introduce un número del 1 al 5!") except ValueError: print("Introduce un valor numérico!") if op == 5: print("Adiós, vuelve pronto!") break if op == 1:
from evento import Evento from controlador import Controlador controlador = Controlador() while True: print() print("********** MENU EVENTOS **********") print("Total eventos registrados: ", controlador.numEventos()) print("1.- Añadir Evento") print("2.- Añadir Participante a Evento") print("3.- Listar eventos pendientes de realizar (sin participantes)") print("4.- Listar eventos pendientes de realizar (con participantes)") print("5.- Listar eventos acabados con podium") print("6.- Finalizar un Evento") print("7.- Salir") while True: try: op = int(input("Introduce Opción: ")) if op <= 6 and op >= 1: break else: print("Introduce un numero del 1 al 6") except ValueError: print("Introduce un numero!")
from socios import Socios from controlador import Controlador from datetime import datetime controlador = Controlador() while True: print("Actualmente hay ", controlador.numSocios(), " socios") print("1.- Añadir Socio") print("2.- Eliminar Socio") print("3.- Listar Socios") print("4.- Registrar Productos") print("5.- Actualizar Saldo") print("6.- Ficha de Socio") print("7.- Salir") while True: try: op = int(input("Introduce opción:")) if op >= 1 and op <= 7: break else: print("Introduce un numero del 1 al 7!") except ValueError: print("Introduce un numero!") if op == 7:
def __init__(self, data): Controlador.__init__(self, data) self.add_vista("administrativo") self.servir()
def __init__(self, data): Controlador.__init__(self, data) self.vista = "" self.vistas = []
def Simulador(virus): # Initialize glfw if not glfw.init(): sys.exit() width = 700 height = 700 window = glfw.create_window(width, height, 'Simulador de contagios', None, None) if not window: glfw.terminate() sys.exit() glfw.make_context_current(window) controlador = Controlador() # Connecting the callback function 'on_key' to handle keyboard events glfw.set_key_callback(window, controlador.on_key) # Assembling the shader program (pipeline) with both shaders pipeline = es.SimpleTransformShaderProgram() pipeline_texturas = es.SimpleTextureTransformShaderProgram() # Setting up the clear screen color glClearColor(245 / 255, 222 / 255, 179 / 255, 1.0) # Our shapes here are always fully painted glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) # magia para que no se vea negro el png glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) poblacion_modelo = Poblacion(virus) individuos = crearPersonas(poblacion_modelo) personitas = crearObjetosDibujo(individuos) controlador.setModelo(poblacion_modelo) controlador.setDibujos(personitas) print(personitas[1][1].getPosicion()) t0 = 0 while not glfw.window_should_close(window): # Dibujando --> 1. obtener el input # Using GLFW to check for input events glfw.poll_events() # OBTIENE EL INPUT --> CONTROLADOR --> MODELOS # Clearing the screen in both, color and depth glClear(GL_COLOR_BUFFER_BIT) # Reconocer la logica # DIBUJAR LOS MODELOS glUseProgram(pipeline.shaderProgram) for dibujo in personitas: if dibujo[1].isVivo(): dibujo[0].draw(pipeline, dibujo[1].isContagiado()) # Calculamos el dt ti = glfw.get_time() margen = 1 dt = ti - t0 if dt > margen: t0 = glfw.get_time() # Once the render is done, buffers are swapped, showing only the complete scene. glfw.swap_buffers(window) glfw.terminate()
from libro import Libro from controlador import Controlador con = Controlador() while True: print("---------- COLECCION DE LIBROS ------------") print("El numero de libros registrados es ",con.getNumLibros()) print("1.- Anyadir libros") print("2.- Eliminar libros") print("3.- Listar libros") print("4.- Libro con menor valoracion") print("5.- Libro con mayor valoracion") print("6.- Salir") op = int(input("Selecciona una opcion: ")) if op == 1: while True: try: isbn = int(input("Introduce el ISBN: ")) if isbn == 0: print("----------------------") print("El ISBN no puede ser 0") print("----------------------") else: break except ValueError: print("--------------------") print("El ISBN no es valido") print("--------------------")
from evento import Evento from controlador import Controlador from datetime import datetime con = Controlador() while True: print("El numero de eventos es ", con.getNumEventos()) print("1.- Anyadir evento") print("2.- Anyadir participante a evento") print("3.- Listar eventos pendientes de realizar sin participantes") print("4.- Listar eventos pendientes de realizar con participantes") print("5.- Listar eventos acabados con podium") print("6.- Finalizar un evento") print("7.- Salir") op = int(input("Elige una opcion: ")) if op == 1: while True: nombre = input("Cual es el nombre del evento: ") if nombre == "": print("El nombre no puede estar en blanco!!") else: break while True: fecha = datetime.now() fechaForm = fecha.strftime("%d/%m/%Y %H:%M") print("--------------")
#título: CUE Genesis #autor: Crisspro #lisencia: GPL-3.0. import pdb import webbrowser import wx from controlador import Controlador from vista.grafica import Programa #Controlador.verificarNuevaVersion(None) App = wx.App() controlador = Controlador() controlador.load() Programa(None, title='CUE Genesis', controlador=controlador) App.MainLoop()
class Ventas_frame(wx.Panel): def __init__(self,parent, **kwds): kwds["style"] = wx.TAB_TRAVERSAL wx.Panel.__init__(self, parent, size=(800,600), **kwds) self.parent=parent lista=[] self.consulta=Consultas() self.controlador=Controlador() lista=self.consulta.lista(lista) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("ID")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.text_ctrl_1.SetMaxLength(2) self.text_ctrl_1.Bind(wx.EVT_TEXT_ENTER,self.control_id) self.label_2 = wx.StaticText(self, wx.ID_ANY, _("NOMBRE")) self.combo_box_1 = wx.ComboBox(self, wx.ID_ANY, choices=lista, style=wx.CB_SIMPLE) self.label_3 = wx.StaticText(self, wx.ID_ANY, _("CANTIDAD: ")) self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.button_1 = wx.Button(self, wx.ID_ANY, _("INGRESAR")) self.Bind(wx.EVT_BUTTON,self.boton_ingresar,self.button_1) self.button_2 = wx.Button(self, wx.ID_ANY, _("FACTURAR")) self.Bind(wx.EVT_BUTTON,self.boton_facturar,self.button_2) self.grid_1 = wx.grid.Grid(self, wx.ID_ANY, size=(1, 1)) self.label_4 = wx.StaticText(self, wx.ID_ANY, _("TOTAL : ")) self.text_ctrl_3 = wx.TextCtrl(self, wx.ID_ANY, "0") self.label_5 = wx.StaticText(self, wx.ID_ANY, _("PAGA CON : ")) self.text_ctrl_4 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.label_6 = wx.StaticText(self, wx.ID_ANY, _("VUELTO : ")) self.text_ctrl_5 = wx.TextCtrl(self, wx.ID_ANY, "",style=wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_TEXT_ENTER,self.limpiar_todo,self.text_ctrl_5) self.button_3 = wx.Button(self, wx.ID_ANY, _(u"ATR\xc1S")) self.Bind(wx.EVT_BUTTON, self.boton_atras,self.button_3) self.button_4 = wx.Button(self, wx.ID_ANY, _("SALIR")) self.Bind(wx.EVT_BUTTON, self.boton_salir,self.button_4) self.__set_properties() self.__do_layout() self.text_ctrl_1.SetFocus() # end wxGlade def __set_properties(self): # begin wxGlade: MyPanel.__set_properties self.grid_1.CreateGrid(0, 5) self.grid_1.SetSelectionMode(wx.grid.Grid.wxGridSelectRows) self.grid_1.SetColLabelValue(0, _("ID")) self.grid_1.SetColSize(0, -1) self.grid_1.SetColLabelValue(1, _("NOMBRE")) self.grid_1.SetColSize(1, 160) self.grid_1.SetColLabelValue(2, _("CANTIDAD")) self.grid_1.SetColSize(2,-1) self.grid_1.SetColLabelValue(3, _("PRECIO UNITARIO")) self.grid_1.SetColSize(3,-1) self.grid_1.SetColLabelValue(4, _("PRECIO ")) self.grid_1.SetColSize(4,-1) self.grid_1.SetMinSize((600, 220)) # end wxGlade def __do_layout(self): # begin wxGlade: MyPanel.__do_layout sizer_1 = wx.BoxSizer(wx.HORIZONTAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) sizer_6 = wx.BoxSizer(wx.HORIZONTAL) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) sizer_4.Add(self.label_1, 0, 0, 0) sizer_4.Add(self.text_ctrl_1, 0, 0, 0) sizer_4.Add(self.label_2, 0, 0, 0) sizer_4.Add(self.combo_box_1, 0, 0, 0) sizer_4.Add(self.label_3, 0, 0, 0) sizer_4.Add(self.text_ctrl_2, 0, 0, 0) sizer_4.Add(self.button_1, 0, 0, 0) sizer_4.Add(self.button_2, 0, 0, 0) sizer_3.Add(sizer_4, 2, wx.TOP | wx.BOTTOM, 15) sizer_2.Add(sizer_3, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_2.Add(self.grid_1, 0, wx.TOP | wx.ALIGN_CENTER_HORIZONTAL, 15) sizer_5.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL, 30) sizer_5.Add(self.text_ctrl_3, 0, 0, 0) sizer_5.Add(self.label_5, 0, wx.ALIGN_CENTER_VERTICAL, 30) sizer_5.Add(self.text_ctrl_4, 0, 0, 0) sizer_5.Add(self.label_6, 0, wx.ALIGN_CENTER_VERTICAL, 30) sizer_5.Add(self.text_ctrl_5, 0, 0, 0) sizer_2.Add(sizer_5, 1, wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_HORIZONTAL, 20) sizer_6.Add(self.button_3, 0, wx.RIGHT, 10) sizer_6.Add(self.button_4, 0, wx.LEFT, 10) sizer_2.Add(sizer_6, 1, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer_1.Add(sizer_2, 1, wx.TOP, 15) self.SetSizer(sizer_1) # end wxGlade def boton_salir(self,event): ret = wx.MessageBox('Quieres salir del programa?', 'Question', wx.YES_NO | wx.NO_DEFAULT, self) if ret == wx.YES: self.Close(True) self.parent.Close(True) def boton_atras(self,event): self.parent.panel.Show() self.Destroy() def control_id(self,event): self.id_producto=self.text_ctrl_1.GetValue() self.nombre=self.consulta.buscar_id(self.id_producto) self.combo_box_1.SetValue('%s'%(self.nombre)) self.text_ctrl_2.SetFocus() def boton_facturar(self,event): self.text_ctrl_4.SetFocus() self.Bind(wx.EVT_TEXT_ENTER,self.facturar,self.text_ctrl_4) def facturar(self,event): if self.text_ctrl_4.GetValue()=='': self.text_ctrl_5.SetFocus() else: self.paga_con=self.text_ctrl_4.GetValue() self.vuelto=self.controlador.vuelto(self.paga_con,self.total) self.text_ctrl_5.AppendText('%s'%(self.vuelto)) self.text_ctrl_5.SetFocus() def boton_ingresar(self,event): self.grid_1.AppendRows(1) aux=self.grid_1.GetNumberRows() self.nombre=self.combo_box_1.GetValue() self.cantidad=self.text_ctrl_2.GetValue() (id_producto,precio_unidad)=self.consulta.buscar_datos(self.nombre) self.precio=self.controlador.precio_cantidad(self.cantidad,precio_unidad) self.grid_1.SetCellValue(aux-1,0,str(id_producto)) self.grid_1.SetCellValue(aux-1,1,self.nombre) self.grid_1.SetCellValue(aux-1,2,self.cantidad) self.grid_1.SetCellValue(aux-1,3,str(precio_unidad)) self.grid_1.SetCellValue(aux-1,4,str(self.precio)) total=self.text_ctrl_3.GetValue() self.total=self.controlador.precios_total(self.precio,total) self.text_ctrl_3.Clear() self.text_ctrl_3.AppendText('%s'%(self.total)) self.limpiar_campos() self.text_ctrl_1.SetFocus() def limpiar_campos(self): self.text_ctrl_1.Clear() self.combo_box_1.SetValue("") self.text_ctrl_2.Clear() def limpiar_todo(self,event): aux=self.grid_1.GetNumberRows() self.grid_1.ClearGrid() aux=self.grid_1.GetNumberRows() for i in range(aux): self.grid_1.DeleteRows(i,0-1) self.text_ctrl_3.Clear() self.text_ctrl_5.Clear() self.text_ctrl_4.Clear() self.text_ctrl_1.SetFocus()
from factura import Factura from controlador import Controlador from datetime import datetime con = Controlador() while True: print("El numero total de facturas disponibles es ", con.getNumFacturas()) print("1.- Anyadir Factura") print("2.- Listar Facturas pendientes de pago") print("3.- Listar Facturas pagadas") print("4.- Pagar factura") print("5.- Salir") op = int(input("Selecciona una opcion: ")) if op == 1: while True: try: id = int(input("Introduce un Id: ")) break except ValueError: print("-------------------------------") print("Error en la introduccion del Id") print("-------------------------------") while True: fecha = datetime.now() fechaForm = fecha.strftime("%d/%m/%Y %H:%M") print("--------------") print("Fecha anyadida")