Good afternoon, I hope someone can help me with this error: The code is executed but it throws me an error:
from PyQt5.QtWidgets import QMainWindow,QApplication, QTableWidgetItem
from PyQt5 import uic
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
import threading
class Principal(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
uic.loadUi("tabla-p.ui",self)
self.funcion(self.tabla)
def funcion(self,t):
s = len(fire_val)
while s >0:
for key in fire_val.values():
id = key.get('id')
t.insertRow(t.rowCount())
t.setItem(t.rowCount()-1,0,QTableWidgetItem(id))
t.setItem(t.rowCount()-1,1,QTableWidgetItem(id))
s =-1
def fire():
cred =credentials.Certificate("2.json")
firebase_admin.initialize_app(cred,{
'databaseURL':'https://new1-3b819.firebaseio.com/'
})
ref = db.reference('/Productos_Bar')
r1 = ref.get()
global fire_val
fire_val = r1
return fire_val
thread = list()
thread2 = list()
t = threading.Thread(target=Principal.fire)
t2 = threading.Thread(target=Principal.funcion)
thread.append(t)
thread2.append(t2)
t.start()
t2.start()
t.join()
t2.join()
app = QApplication([])
p=Principal()
p.show()
app.exec_()
this is the error:
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Angel\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
TypeError: funcion() missing 2 required positional arguments: 'self' and 't'
[Finished in 4.1s]