Home » Python » python – to calculate the value of a database by a variable-Exceptionshub

python – to calculate the value of a database by a variable-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I am in need of help, I am creating a program with SQL that will subtract the data from the variable, to overwrite the old value, could you help me? Here is the script:

def vender_command():
    import PySimpleGUI as sg
    sg.theme('DarkAmber')      
    layout = [[sg.Text('Quantos deseja vender ?')],
             [sg.Input(),sg.OK()]] 
    window = sg.Window('Estoque -  Vender', layout)    
    event, values = window.read()    
    qtdvender=int(values[0])
    Quantidade = ?????
    if qtdvender>Quantidade:
        sg.popup('Não possui itens o suficiente para vender')
    elif qtdvender>=Quantidade:
        Lucro=qtdvender*Preço 
        sobra=Quantidade-qtdvender      
        core.update(selected[0],"SELECT(Quantidade"-"'qtdvender')AS QUANTIDADE")
        ver_command()
How to&Answers: