Update a single selected record with Tkinter y, Psycopg2 [closed]

1

I already managed to update with (Psycopg2-Tkinter). But he does it on all records, as I do to apply only to the selected record.

Button(self.edit_wind, text='Actualizar',
               command=lambda: self.edit_records(nombre=new_nombre.get(), salario=new_salario.get())).grid(row=4,
                                                                                                           column=2,
                                                                                                           sticky=W)
        self.edit_wind.mainloop()


    def edit_records(self, nombre, salario):

        query=("UPDATE empleado SET nombre=%s, salario=%s where id=%s")  


        parameters = (nombre, salario)
        self.run_query(query, parameters)
        self.edit_wind.destroy()
        self.message['text'] = 'Empleado {} Actualizado Satisfactoriamente'.format(nombre)
        self.get_empleados()



if __name__ == '__main__':
    window = root()
    application = Empleado(window)
    window.mainloop()
    #tk.Button.quit()
  

If you want to review the entire code, this is the link .

     

    
asked by Jsierra2017 21.12.2018 в 23:01
source

0 answers