Calificación:
  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Problemas con validatecommand
#1
Amigos, les cuento mi problema:

En una aplicacion de escritorio, que maneja las cobranzas por alumnos por grupo , tengo entry's que piden los datos (Alumno, Grupo, Vestuario, Tipo de valor, etc) son validadas con validatecommand y su respectiva funcion, donde valida si el dato esta en labase de datos...
Desde un treeview se selecciona el registro a modificar o desde un boton se agrega uno nuevo, el primer movimiento (nuevo o modificacion) es validado como corresponde pero los siguientes no lo hace, no encuentro donde esta la falla, ayuda por favor !!!
Les comparto una parte del codigo, diganme si lo necesitan completo, desde ya muchas gracias


    def fBuscaAlumno(self):
#        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtAlum.get()
        OpAlum = libdbFenixia.fCargaAlumno(clave)    
        self.vgCodAlum = OpAlum[0]
        self.vgNombreAlum = OpAlum[2] + " " + OpAlum[3]
        lblAlum = Label(text = self.vgNombreAlum, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblAlum.place(x = 236, y = 20)
        return            
    def fBuscaGrupo(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtGrup.get()
#        print("fBuscaGrupo clave:", clave, " tipo:", type(clave), "self.vgCodGrupo:", self.vgCodGrupo, " tipo:", type(self.vgCodGrupo))
        OpGrupo = libdbFenixia.fCargaGrupo(clave)    
        self.vgCodGrupo = OpGrupo[0]
        self.vgNombreGrupo = OpGrupo[2]
        clave = OpGrupo[1]
        print("fBuscaGrupos clave:", clave, "OpGrupo[1]:",OpGrupo[1])
        print("- - - - - - - - - - - -")
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[1] + " " + OpProfe[2]
        lblGrupo = Label(text = self.vgNombreGrupo, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblGrupo.place(x = 210, y = 48)
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 490, y = 48)
       return            
    def fBuscaProfesora(self):
        clave = self.txtProf.get()
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[2] + " " + OpProfe[3]
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 240, y = 178)
        return            
    def fBuscaValor(self):
        clave = self.txtVal.get().capitalize()
        OpVal = libdbFenixia.fCargaTipoValor(clave)
        print("fBuscaValor:", OpVal)    
        self.vgCodVal = OpVal[1]
        self.vgNombreVal = OpVal[2]
        self.lblVal = Label(text = self.vgNombreVal, width = 22, justify='left', bg = "ivory2", fg = "black")
        self.lblVal.place(x = 200, y = 98)
        return
       
    def fBuscaVestuario(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtVest.get().upper()
        OpVest = libdbFenixia.fCargaVestuario(clave)    
        self.vgCodVest = OpVest[1]
        self.vgNombreVest = OpVest[3]
        self.vgImporte = OpVest[8]
        self.txtImpr.insert(0, self.vgImporte)
        lblVest = Label(text = self.vgNombreVest, width = 30, justify='left', bg = "ivory2", fg = "black")
        lblVest.place(x = 222, y = 73)
        return
       
    def CreaWidgets(self):
        self.frame1 = LabelFrame(self, text = ' Opciones ', bg = "#bfdaff", border = 1, relief = 'solid')
        self.frame1.place(x = 10, y = 0, width = 100, height = 436)    
        self.btnNuevo=Button(self.frame1, text = "Nuevo", command = self.fNuevo, bg = "forest green", fg = "white")
        self.btnNuevo.place(x = 5, y = 75, width = 80, height = 30 )        
        self.btnModificar = Button(self.frame1, text = "Modificar", command = self.fModificar, bg = "forest green", fg = "white")
        self.btnModificar.place(x = 5, y = 125, width = 80, height = 30)                
        self.btnEliminar = Button(self.frame1, text = "Eliminar", command = self.fEliminar, bg = "forest green", fg = "white")
        self.btnEliminar.place(x = 5, y = 175, width = 80, height = 30)
        self.btnSalir = Button(self.frame1, text = "Salir", command = self.fSalir, bg = "red3", fg = "white")
        self.btnSalir.place(x = 5, y = 225, width = 80, height = 30)
        frame4 = LabelFrame(self, text = ' Cobranza ', bg = "#d3dde3", border = 1, relief = 'solid')
        frame4.place(x = 120, y = 0, width = 550, height = 160)
        ValorY = 5
        lbl01 = Label(frame4, text = "Alumno: ", bg = "steelblue1", fg = "white")
        lbl01.place(x = 25, y = ValorY)      
        lbl02 = Label(frame4, text = self.vgNombreAlum, bg = "ivory2", fg = "black")
        lbl02.place(x = 111, y = ValorY)
        ValorY = 30
        lblg3 = Label(frame4, text = "Grupo:", bg = "steelblue1", fg = "white")
        lblg3.place(x = 10, y = ValorY)
        lblg3a = Label(frame4, text ="12345", bg = "ivory2", fg = "black")
        lblg3a.place(x = 52, y = ValorY)
        lblg3b = Label(frame4, text = self.vgNombreGrupo, bg = "ivory2", fg = "black")
        lblg3b.place(x = 86, y = ValorY)
        lblg3c = Label(frame4, text = "Profesora: ", bg = "steelblue1", fg = "white")
        lblg3c.place(x = 306, y = ValorY)
        lblg3d = Label(frame4, text = self.vgNombreProf, bg = "ivory2", fg = "black")
        lblg3d.place(x = 368, y = ValorY)      
        ValorY = 55
        lbl04 = Label(frame4, text="Vestuario:", bg = "steelblue1", fg = "white")
        lbl04.place(x = 10, y = ValorY)
        lbl04a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl04a.place(x = 68, y = ValorY)
        lbl04b = Label(frame4, text="Vestuario-123456789012345", bg = "ivory2", fg = "black")
        lbl04b.place(x = 102, y = ValorY)
        lbl04c = Label(frame4, text="Concepto:", bg = "steelblue1", fg = "white")
        lbl04c.place(x = 320, y = ValorY)
        lbl04d = Label(frame4, text="Concepto--123456789012345", bg = "ivory2", fg = "black")
        lbl04d.place(x = 380, y = ValorY)
        ValorY = 80
        lbl05 = Label(frame4, text="Valor:", bg = "steelblue1", fg = "white")
        lbl05.place(x = 10, y = ValorY)
        lbl05a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl05a.place(x = 44, y = ValorY)
        lbl05b = Label(frame4, text="Valor-----123456789012345", bg = "ivory2", fg = "black")
        lbl05b.place(x = 80, y = ValorY)
        lbl05c = Label(frame4, text = "Fecha de pago:", bg = "steelblue1", fg = "white")
        lbl05c.place(x = 260, y = ValorY)
        lbl05d = Label(frame4, text = "11/11/2025", bg = "ivory2", fg = "black")
        lbl05d.place(x = 346, y = ValorY)
        lbl05e = Label(frame4, text="Importe:", bg = "steelblue1", fg = "white")
        lbl05e.place(x = 430, y = ValorY)
        lbl05f = Label(frame4, text="100.000.00", bg = "ivory2", fg = "black")
        lbl05f.place(x = 480, y = ValorY)
       
        ValorY = 5
        self.txtAlum = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaAlumno)
        self.txtAlum.place(x = 80, y = ValorY)
        ValorY = 30
        self.txtGrup = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaGrupo)
        self.txtGrup.place(x = 52, y = ValorY)
        ValorY = 55
        self.txtVest = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaVestuario)
        self.txtVest.place(x = 68, y = ValorY)        
        self.txtConc = Entry(frame4, width = 25, justify = 'left')
        self.txtConc.place(x = 380, y = ValorY)
        ValorY = 80
        self.txtVal = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaValor)
        self.txtVal.place(x = 44, y = ValorY)        
        self.txtFecha = Entry(frame4, width = 10, justify = 'right')
        self.txtFecha.place(x = 346, y = ValorY)
        self.txtImpr = Entry(frame4, width = 10, justify = 'right')
        self.txtImpr.place(x = 480, y = ValorY)      
        ValorY = 105  
        self.btnGuardar = Button(frame4, text = "Guardar", command = self.fGuardar, bg = "sea green", fg = "white")
        self.btnGuardar.place(x = 200, y = ValorY, width = 60, height = 30)
        self.btnCancelar = Button(frame4, text = "Cancelar", command = self.fCancelar, bg = "red3", fg = "white")
        self.btnCancelar.place(x = 300, y = ValorY, width = 60, height = 30)

    def fBuscaAlumno(self):
#        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtAlum.get()
        OpAlum = libdbFenixia.fCargaAlumno(clave)    
        self.vgCodAlum = OpAlum[0]
        self.vgNombreAlum = OpAlum[2] + " " + OpAlum[3]
        lblAlum = Label(text = self.vgNombreAlum, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblAlum.place(x = 236, y = 20)
        return            
    def fBuscaGrupo(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtGrup.get()
#        print("fBuscaGrupo clave:", clave, " tipo:", type(clave), "self.vgCodGrupo:", self.vgCodGrupo, " tipo:", type(self.vgCodGrupo))
        OpGrupo = libdbFenixia.fCargaGrupo(clave)    
        self.vgCodGrupo = OpGrupo[0]
        self.vgNombreGrupo = OpGrupo[2]
        clave = OpGrupo[1]
        print("fBuscaGrupos clave:", clave, "OpGrupo[1]:",OpGrupo[1])
        print("- - - - - - - - - - - -")
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[1] + " " + OpProfe[2]
        lblGrupo = Label(text = self.vgNombreGrupo, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblGrupo.place(x = 210, y = 48)
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 490, y = 48)
       return            
    def fBuscaProfesora(self):
        clave = self.txtProf.get()
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[2] + " " + OpProfe[3]
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 240, y = 178)
        return            
    def fBuscaValor(self):
        clave = self.txtVal.get().capitalize()
        OpVal = libdbFenixia.fCargaTipoValor(clave)
        print("fBuscaValor:", OpVal)    
        self.vgCodVal = OpVal[1]
        self.vgNombreVal = OpVal[2]
        self.lblVal = Label(text = self.vgNombreVal, width = 22, justify='left', bg = "ivory2", fg = "black")
        self.lblVal.place(x = 200, y = 98)
        return
       
    def fBuscaVestuario(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtVest.get().upper()
        OpVest = libdbFenixia.fCargaVestuario(clave)    
        self.vgCodVest = OpVest[1]
        self.vgNombreVest = OpVest[3]
        self.vgImporte = OpVest[8]
        self.txtImpr.insert(0, self.vgImporte)
        lblVest = Label(text = self.vgNombreVest, width = 30, justify='left', bg = "ivory2", fg = "black")
        lblVest.place(x = 222, y = 73)
        return
       
    def CreaWidgets(self):
        self.frame1 = LabelFrame(self, text = ' Opciones ', bg = "#bfdaff", border = 1, relief = 'solid')
        self.frame1.place(x = 10, y = 0, width = 100, height = 436)    
        self.btnNuevo=Button(self.frame1, text = "Nuevo", command = self.fNuevo, bg = "forest green", fg = "white")
        self.btnNuevo.place(x = 5, y = 75, width = 80, height = 30 )        
        self.btnModificar = Button(self.frame1, text = "Modificar", command = self.fModificar, bg = "forest green", fg = "white")
        self.btnModificar.place(x = 5, y = 125, width = 80, height = 30)                
        self.btnEliminar = Button(self.frame1, text = "Eliminar", command = self.fEliminar, bg = "forest green", fg = "white")
        self.btnEliminar.place(x = 5, y = 175, width = 80, height = 30)
        self.btnSalir = Button(self.frame1, text = "Salir", command = self.fSalir, bg = "red3", fg = "white")
        self.btnSalir.place(x = 5, y = 225, width = 80, height = 30)
        frame4 = LabelFrame(self, text = ' Cobranza ', bg = "#d3dde3", border = 1, relief = 'solid')
        frame4.place(x = 120, y = 0, width = 550, height = 160)
        ValorY = 5
        lbl01 = Label(frame4, text = "Alumno: ", bg = "steelblue1", fg = "white")
        lbl01.place(x = 25, y = ValorY)      
        lbl02 = Label(frame4, text = self.vgNombreAlum, bg = "ivory2", fg = "black")
        lbl02.place(x = 111, y = ValorY)
        ValorY = 30
        lblg3 = Label(frame4, text = "Grupo:", bg = "steelblue1", fg = "white")
        lblg3.place(x = 10, y = ValorY)
        lblg3a = Label(frame4, text ="12345", bg = "ivory2", fg = "black")
        lblg3a.place(x = 52, y = ValorY)
        lblg3b = Label(frame4, text = self.vgNombreGrupo, bg = "ivory2", fg = "black")
        lblg3b.place(x = 86, y = ValorY)
        lblg3c = Label(frame4, text = "Profesora: ", bg = "steelblue1", fg = "white")
        lblg3c.place(x = 306, y = ValorY)
        lblg3d = Label(frame4, text = self.vgNombreProf, bg = "ivory2", fg = "black")
        lblg3d.place(x = 368, y = ValorY)      
        ValorY = 55
        lbl04 = Label(frame4, text="Vestuario:", bg = "steelblue1", fg = "white")
        lbl04.place(x = 10, y = ValorY)
        lbl04a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl04a.place(x = 68, y = ValorY)
        lbl04b = Label(frame4, text="Vestuario-123456789012345", bg = "ivory2", fg = "black")
        lbl04b.place(x = 102, y = ValorY)
        lbl04c = Label(frame4, text="Concepto:", bg = "steelblue1", fg = "white")
        lbl04c.place(x = 320, y = ValorY)
        lbl04d = Label(frame4, text="Concepto--123456789012345", bg = "ivory2", fg = "black")
        lbl04d.place(x = 380, y = ValorY)
        ValorY = 80
        lbl05 = Label(frame4, text="Valor:", bg = "steelblue1", fg = "white")
        lbl05.place(x = 10, y = ValorY)
        lbl05a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl05a.place(x = 44, y = ValorY)
        lbl05b = Label(frame4, text="Valor-----123456789012345", bg = "ivory2", fg = "black")
        lbl05b.place(x = 80, y = ValorY)
        lbl05c = Label(frame4, text = "Fecha de pago:", bg = "steelblue1", fg = "white")
        lbl05c.place(x = 260, y = ValorY)
        lbl05d = Label(frame4, text = "11/11/2025", bg = "ivory2", fg = "black")
        lbl05d.place(x = 346, y = ValorY)
        lbl05e = Label(frame4, text="Importe:", bg = "steelblue1", fg = "white")
        lbl05e.place(x = 430, y = ValorY)
        lbl05f = Label(frame4, text="100.000.00", bg = "ivory2", fg = "black")
        lbl05f.place(x = 480, y = ValorY)
       
        ValorY = 5
        self.txtAlum = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaAlumno)
        self.txtAlum.place(x = 80, y = ValorY)
        ValorY = 30
        self.txtGrup = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaGrupo)
        self.txtGrup.place(x = 52, y = ValorY)
        ValorY = 55
        self.txtVest = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaVestuario)
        self.txtVest.place(x = 68, y = ValorY)        
        self.txtConc = Entry(frame4, width = 25, justify = 'left')
        self.txtConc.place(x = 380, y = ValorY)
        ValorY = 80
        self.txtVal = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaValor)
        self.txtVal.place(x = 44, y = ValorY)        
        self.txtFecha = Entry(frame4, width = 10, justify = 'right')
        self.txtFecha.place(x = 346, y = ValorY)
        self.txtImpr = Entry(frame4, width = 10, justify = 'right')
        self.txtImpr.place(x = 480, y = ValorY)      
        ValorY = 105  
        self.btnGuardar = Button(frame4, text = "Guardar", command = self.fGuardar, bg = "sea green", fg = "white")
        self.btnGuardar.place(x = 200, y = ValorY, width = 60, height = 30)
        self.btnCancelar = Button(frame4, text = "Cancelar", command = self.fCancelar, bg = "red3", fg = "white")
        self.btnCancelar.place(x = 300, y = ValorY, width = 60, height = 30)
Responder
#2
(30-04-2025, 10:13 PM)Basko escribió: Amigos, les cuento mi problema:

En una aplicacion de escritorio, que maneja las cobranzas por alumnos por grupo , tengo entry's que piden los datos (Alumno, Grupo, Vestuario, Tipo de valor, etc) son validadas con validatecommand y su respectiva funcion, donde valida si el dato esta en labase de datos...
Desde un treeview se selecciona el registro a modificar o desde un boton se agrega uno nuevo, el primer movimiento (nuevo o modificacion) es validado como corresponde pero los siguientes no lo hace, no encuentro donde esta la falla, ayuda por favor !!!
Les comparto una parte del codigo, diganme si lo necesitan completo, desde ya muchas gracias


    def fBuscaAlumno(self):
#        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtAlum.get()
        OpAlum = libdbFenixia.fCargaAlumno(clave)    
        self.vgCodAlum = OpAlum[0]
        self.vgNombreAlum = OpAlum[2] + " " + OpAlum[3]
        lblAlum = Label(text = self.vgNombreAlum, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblAlum.place(x = 236, y = 20)
        return            
    def fBuscaGrupo(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtGrup.get()
#        print("fBuscaGrupo clave:", clave, " tipo:", type(clave), "self.vgCodGrupo:", self.vgCodGrupo, " tipo:", type(self.vgCodGrupo))
        OpGrupo = libdbFenixia.fCargaGrupo(clave)    
        self.vgCodGrupo = OpGrupo[0]
        self.vgNombreGrupo = OpGrupo[2]
        clave = OpGrupo[1]
        print("fBuscaGrupos clave:", clave, "OpGrupo[1]:",OpGrupo[1])
        print("- - - - - - - - - - - -")
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[1] + " " + OpProfe[2]
        lblGrupo = Label(text = self.vgNombreGrupo, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblGrupo.place(x = 210, y = 48)
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 490, y = 48)
       return            
    def fBuscaProfesora(self):
        clave = self.txtProf.get()
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[2] + " " + OpProfe[3]
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 240, y = 178)
        return            
    def fBuscaValor(self):
        clave = self.txtVal.get().capitalize()
        OpVal = libdbFenixia.fCargaTipoValor(clave)
        print("fBuscaValor:", OpVal)    
        self.vgCodVal = OpVal[1]
        self.vgNombreVal = OpVal[2]
        self.lblVal = Label(text = self.vgNombreVal, width = 22, justify='left', bg = "ivory2", fg = "black")
        self.lblVal.place(x = 200, y = 98)
        return
       
    def fBuscaVestuario(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtVest.get().upper()
        OpVest = libdbFenixia.fCargaVestuario(clave)    
        self.vgCodVest = OpVest[1]
        self.vgNombreVest = OpVest[3]
        self.vgImporte = OpVest[8]
        self.txtImpr.insert(0, self.vgImporte)
        lblVest = Label(text = self.vgNombreVest, width = 30, justify='left', bg = "ivory2", fg = "black")
        lblVest.place(x = 222, y = 73)
        return
       
    def CreaWidgets(self):
        self.frame1 = LabelFrame(self, text = ' Opciones ', bg = "#bfdaff", border = 1, relief = 'solid')
        self.frame1.place(x = 10, y = 0, width = 100, height = 436)    
        self.btnNuevo=Button(self.frame1, text = "Nuevo", command = self.fNuevo, bg = "forest green", fg = "white")
        self.btnNuevo.place(x = 5, y = 75, width = 80, height = 30 )        
        self.btnModificar = Button(self.frame1, text = "Modificar", command = self.fModificar, bg = "forest green", fg = "white")
        self.btnModificar.place(x = 5, y = 125, width = 80, height = 30)                
        self.btnEliminar = Button(self.frame1, text = "Eliminar", command = self.fEliminar, bg = "forest green", fg = "white")
        self.btnEliminar.place(x = 5, y = 175, width = 80, height = 30)
        self.btnSalir = Button(self.frame1, text = "Salir", command = self.fSalir, bg = "red3", fg = "white")
        self.btnSalir.place(x = 5, y = 225, width = 80, height = 30)
        frame4 = LabelFrame(self, text = ' Cobranza ', bg = "#d3dde3", border = 1, relief = 'solid')
        frame4.place(x = 120, y = 0, width = 550, height = 160)
        ValorY = 5
        lbl01 = Label(frame4, text = "Alumno: ", bg = "steelblue1", fg = "white")
        lbl01.place(x = 25, y = ValorY)      
        lbl02 = Label(frame4, text = self.vgNombreAlum, bg = "ivory2", fg = "black")
        lbl02.place(x = 111, y = ValorY)
        ValorY = 30
        lblg3 = Label(frame4, text = "Grupo:", bg = "steelblue1", fg = "white")
        lblg3.place(x = 10, y = ValorY)
        lblg3a = Label(frame4, text ="12345", bg = "ivory2", fg = "black")
        lblg3a.place(x = 52, y = ValorY)
        lblg3b = Label(frame4, text = self.vgNombreGrupo, bg = "ivory2", fg = "black")
        lblg3b.place(x = 86, y = ValorY)
        lblg3c = Label(frame4, text = "Profesora: ", bg = "steelblue1", fg = "white")
        lblg3c.place(x = 306, y = ValorY)
        lblg3d = Label(frame4, text = self.vgNombreProf, bg = "ivory2", fg = "black")
        lblg3d.place(x = 368, y = ValorY)      
        ValorY = 55
        lbl04 = Label(frame4, text="Vestuario:", bg = "steelblue1", fg = "white")
        lbl04.place(x = 10, y = ValorY)
        lbl04a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl04a.place(x = 68, y = ValorY)
        lbl04b = Label(frame4, text="Vestuario-123456789012345", bg = "ivory2", fg = "black")
        lbl04b.place(x = 102, y = ValorY)
        lbl04c = Label(frame4, text="Concepto:", bg = "steelblue1", fg = "white")
        lbl04c.place(x = 320, y = ValorY)
        lbl04d = Label(frame4, text="Concepto--123456789012345", bg = "ivory2", fg = "black")
        lbl04d.place(x = 380, y = ValorY)
        ValorY = 80
        lbl05 = Label(frame4, text="Valor:", bg = "steelblue1", fg = "white")
        lbl05.place(x = 10, y = ValorY)
        lbl05a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl05a.place(x = 44, y = ValorY)
        lbl05b = Label(frame4, text="Valor-----123456789012345", bg = "ivory2", fg = "black")
        lbl05b.place(x = 80, y = ValorY)
        lbl05c = Label(frame4, text = "Fecha de pago:", bg = "steelblue1", fg = "white")
        lbl05c.place(x = 260, y = ValorY)
        lbl05d = Label(frame4, text = "11/11/2025", bg = "ivory2", fg = "black")
        lbl05d.place(x = 346, y = ValorY)
        lbl05e = Label(frame4, text="Importe:", bg = "steelblue1", fg = "white")
        lbl05e.place(x = 430, y = ValorY)
        lbl05f = Label(frame4, text="100.000.00", bg = "ivory2", fg = "black")
        lbl05f.place(x = 480, y = ValorY)
       
        ValorY = 5
        self.txtAlum = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaAlumno)
        self.txtAlum.place(x = 80, y = ValorY)
        ValorY = 30
        self.txtGrup = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaGrupo)
        self.txtGrup.place(x = 52, y = ValorY)
        ValorY = 55
        self.txtVest = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaVestuario)
        self.txtVest.place(x = 68, y = ValorY)        
        self.txtConc = Entry(frame4, width = 25, justify = 'left')
        self.txtConc.place(x = 380, y = ValorY)
        ValorY = 80
        self.txtVal = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaValor)
        self.txtVal.place(x = 44, y = ValorY)        
        self.txtFecha = Entry(frame4, width = 10, justify = 'right')
        self.txtFecha.place(x = 346, y = ValorY)
        self.txtImpr = Entry(frame4, width = 10, justify = 'right')
        self.txtImpr.place(x = 480, y = ValorY)      
        ValorY = 105  
        self.btnGuardar = Button(frame4, text = "Guardar", command = self.fGuardar, bg = "sea green", fg = "white")
        self.btnGuardar.place(x = 200, y = ValorY, width = 60, height = 30)
        self.btnCancelar = Button(frame4, text = "Cancelar", command = self.fCancelar, bg = "red3", fg = "white")
        self.btnCancelar.place(x = 300, y = ValorY, width = 60, height = 30)

    def fBuscaAlumno(self):
#        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtAlum.get()
        OpAlum = libdbFenixia.fCargaAlumno(clave)    
        self.vgCodAlum = OpAlum[0]
        self.vgNombreAlum = OpAlum[2] + " " + OpAlum[3]
        lblAlum = Label(text = self.vgNombreAlum, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblAlum.place(x = 236, y = 20)
        return            
    def fBuscaGrupo(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtGrup.get()
#        print("fBuscaGrupo clave:", clave, " tipo:", type(clave), "self.vgCodGrupo:", self.vgCodGrupo, " tipo:", type(self.vgCodGrupo))
        OpGrupo = libdbFenixia.fCargaGrupo(clave)    
        self.vgCodGrupo = OpGrupo[0]
        self.vgNombreGrupo = OpGrupo[2]
        clave = OpGrupo[1]
        print("fBuscaGrupos clave:", clave, "OpGrupo[1]:",OpGrupo[1])
        print("- - - - - - - - - - - -")
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[1] + " " + OpProfe[2]
        lblGrupo = Label(text = self.vgNombreGrupo, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblGrupo.place(x = 210, y = 48)
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 490, y = 48)
       return            
    def fBuscaProfesora(self):
        clave = self.txtProf.get()
        OpProfe = libdbFenixia.fCargaProfesora(clave)    
        self.vgCodProf = OpProfe[0]
        self.vgNombreProf = OpProfe[2] + " " + OpProfe[3]
        lblProf = Label(text = self.vgNombreProf, width = 22, justify='left', bg = "ivory2", fg = "black")
        lblProf.place(x = 240, y = 178)
        return            
    def fBuscaValor(self):
        clave = self.txtVal.get().capitalize()
        OpVal = libdbFenixia.fCargaTipoValor(clave)
        print("fBuscaValor:", OpVal)    
        self.vgCodVal = OpVal[1]
        self.vgNombreVal = OpVal[2]
        self.lblVal = Label(text = self.vgNombreVal, width = 22, justify='left', bg = "ivory2", fg = "black")
        self.lblVal.place(x = 200, y = 98)
        return
       
    def fBuscaVestuario(self):
        print(" - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
        clave = self.txtVest.get().upper()
        OpVest = libdbFenixia.fCargaVestuario(clave)    
        self.vgCodVest = OpVest[1]
        self.vgNombreVest = OpVest[3]
        self.vgImporte = OpVest[8]
        self.txtImpr.insert(0, self.vgImporte)
        lblVest = Label(text = self.vgNombreVest, width = 30, justify='left', bg = "ivory2", fg = "black")
        lblVest.place(x = 222, y = 73)
        return
       
    def CreaWidgets(self):
        self.frame1 = LabelFrame(self, text = ' Opciones ', bg = "#bfdaff", border = 1, relief = 'solid')
        self.frame1.place(x = 10, y = 0, width = 100, height = 436)    
        self.btnNuevo=Button(self.frame1, text = "Nuevo", command = self.fNuevo, bg = "forest green", fg = "white")
        self.btnNuevo.place(x = 5, y = 75, width = 80, height = 30 )        
        self.btnModificar = Button(self.frame1, text = "Modificar", command = self.fModificar, bg = "forest green", fg = "white")
        self.btnModificar.place(x = 5, y = 125, width = 80, height = 30)                
        self.btnEliminar = Button(self.frame1, text = "Eliminar", command = self.fEliminar, bg = "forest green", fg = "white")
        self.btnEliminar.place(x = 5, y = 175, width = 80, height = 30)
        self.btnSalir = Button(self.frame1, text = "Salir", command = self.fSalir, bg = "red3", fg = "white")
        self.btnSalir.place(x = 5, y = 225, width = 80, height = 30)
        frame4 = LabelFrame(self, text = ' Cobranza ', bg = "#d3dde3", border = 1, relief = 'solid')
        frame4.place(x = 120, y = 0, width = 550, height = 160)
        ValorY = 5
        lbl01 = Label(frame4, text = "Alumno: ", bg = "steelblue1", fg = "white")
        lbl01.place(x = 25, y = ValorY)      
        lbl02 = Label(frame4, text = self.vgNombreAlum, bg = "ivory2", fg = "black")
        lbl02.place(x = 111, y = ValorY)
        ValorY = 30
        lblg3 = Label(frame4, text = "Grupo:", bg = "steelblue1", fg = "white")
        lblg3.place(x = 10, y = ValorY)
        lblg3a = Label(frame4, text ="12345", bg = "ivory2", fg = "black")
        lblg3a.place(x = 52, y = ValorY)
        lblg3b = Label(frame4, text = self.vgNombreGrupo, bg = "ivory2", fg = "black")
        lblg3b.place(x = 86, y = ValorY)
        lblg3c = Label(frame4, text = "Profesora: ", bg = "steelblue1", fg = "white")
        lblg3c.place(x = 306, y = ValorY)
        lblg3d = Label(frame4, text = self.vgNombreProf, bg = "ivory2", fg = "black")
        lblg3d.place(x = 368, y = ValorY)      
        ValorY = 55
        lbl04 = Label(frame4, text="Vestuario:", bg = "steelblue1", fg = "white")
        lbl04.place(x = 10, y = ValorY)
        lbl04a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl04a.place(x = 68, y = ValorY)
        lbl04b = Label(frame4, text="Vestuario-123456789012345", bg = "ivory2", fg = "black")
        lbl04b.place(x = 102, y = ValorY)
        lbl04c = Label(frame4, text="Concepto:", bg = "steelblue1", fg = "white")
        lbl04c.place(x = 320, y = ValorY)
        lbl04d = Label(frame4, text="Concepto--123456789012345", bg = "ivory2", fg = "black")
        lbl04d.place(x = 380, y = ValorY)
        ValorY = 80
        lbl05 = Label(frame4, text="Valor:", bg = "steelblue1", fg = "white")
        lbl05.place(x = 10, y = ValorY)
        lbl05a = Label(frame4, text="12345", bg = "ivory2", fg = "black")
        lbl05a.place(x = 44, y = ValorY)
        lbl05b = Label(frame4, text="Valor-----123456789012345", bg = "ivory2", fg = "black")
        lbl05b.place(x = 80, y = ValorY)
        lbl05c = Label(frame4, text = "Fecha de pago:", bg = "steelblue1", fg = "white")
        lbl05c.place(x = 260, y = ValorY)
        lbl05d = Label(frame4, text = "11/11/2025", bg = "ivory2", fg = "black")
        lbl05d.place(x = 346, y = ValorY)
        lbl05e = Label(frame4, text="Importe:", bg = "steelblue1", fg = "white")
        lbl05e.place(x = 430, y = ValorY)
        lbl05f = Label(frame4, text="100.000.00", bg = "ivory2", fg = "black")
        lbl05f.place(x = 480, y = ValorY)
       
        ValorY = 5
        self.txtAlum = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaAlumno)
        self.txtAlum.place(x = 80, y = ValorY)
        ValorY = 30
        self.txtGrup = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaGrupo)
        self.txtGrup.place(x = 52, y = ValorY)
        ValorY = 55
        self.txtVest = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaVestuario)
        self.txtVest.place(x = 68, y = ValorY)        
        self.txtConc = Entry(frame4, width = 25, justify = 'left')
        self.txtConc.place(x = 380, y = ValorY)
        ValorY = 80
        self.txtVal = Entry(frame4, width = 5, justify = 'right', validate = 'focusout', validatecommand = self.fBuscaValor)
        self.txtVal.place(x = 44, y = ValorY)        
        self.txtFecha = Entry(frame4, width = 10, justify = 'right')
        self.txtFecha.place(x = 346, y = ValorY)
        self.txtImpr = Entry(frame4, width = 10, justify = 'right')
        self.txtImpr.place(x = 480, y = ValorY)      
        ValorY = 105  
        self.btnGuardar = Button(frame4, text = "Guardar", command = self.fGuardar, bg = "sea green", fg = "white")
        self.btnGuardar.place(x = 200, y = ValorY, width = 60, height = 30)
        self.btnCancelar = Button(frame4, text = "Cancelar", command = self.fCancelar, bg = "red3", fg = "white")
        self.btnCancelar.place(x = 300, y = ValorY, width = 60, height = 30)
Hola Basko. Realmente se me dificulta muchísimo la lectura del código por la forma en que el foro lo presenta. Te propongo algo.  Crea una función de un solo entry y un botón que contenga el validate. Puedes asociarlo a una salida en pantalla (un print), como para comprobar el funcionamiento del validate. Luego, si quieres, compártelo aquí y lo revisamos juntos. Lo que yo estoy observando, a priori, es que el validate sólo se ejecuta una vez.
Responder


Salto de foro:


Usuarios navegando en este tema: 2 invitado(s)