send the value of one variable in python to another function in another file

0

I would like to know what is failing me with the following code, since I try to send the value of the variable (result) to a function within another file.

this is the code:

from ticket import *
def vender_data(self):
    acount1 = 0 #cantidad de ibjetos
    venta = list()
    result =0 #resultado total
    Ticket().total(result)
    if acount1 == 0:
        s =self.tabla.rowCount()
        for i in range(0,s):
        #   print(self.tabla.item(i,3).text())
            v = float(self.tabla.item(i,3).text())
            venta.append(v)
        for vs in venta:
            result = result+vs
        print(result) # este funciona 
        acount1 = s
        #print(acount1) total de productos
    elif acount1 !=0:
        venta.clear()
        s = self.tabla.rowCount() - acount1
        for i in range(0,s):
        #   print(self.tabla.item(i,3).text())
            v1 = float(self.tabla.item(i,3).text())
            venta.append(v1)
        for vs in venta:
            result = result+vs
        #print(result)
        acount1 = s

    Ticket().exec_()

and this is the file where the value of the variable should arrive:

from PyQt5.QtWidgets import QDialog,QApplication
from PyQt5 import uic



class Ticket(QDialog):
    def __init__(self):
        QDialog.__init__(self)
        uic.loadUi("ticket.ui",self)


    def total(self,total1):
        n = total1
        self.l_total.setText(str(n)) #lineEdit que recive el valor

However, it does not work What am I doing wrong?

    
asked by Revsky01 29.07.2018 в 08:26
source

0 answers