0
Hello guys I’m having a problem, I’m wondering if in Python 3.x would have the possibility of a function to store a previously defined value for later use at another time of the code. As shown in the following example.
First follows a class built at a given time
class login(QMainWindow):
def __init__(self, *args, **argvs):
super(login, self).__init__(*args, **argvs)
self.ui = Ui_login()
self.ui.setupUi(self)
self.ui.button_enter.clicked.connect(self.login)
def login(self):
user = self.ui.user_input.text()
username = login_username_db()
for i in range(0, len(username)):
if user == username[i][0]:
passworld = login_pass_db(user)
senha = self.ui.pass_input.text()
if senha == passworld[0][0]:
#emailogin(user)
load_app(user)
The function load_app(user)
has its construction done as follows.
def load_app (user):
cursor = Database.cursor()
cursor.execute(f'SELECT app1 FROM `{user}` WHERE ID=1')
loadapp = cursor.fetchall()
Next is the class that in a future will call the function def load_app(user)
only to take the value it will possess (if possible).
class userColaborador(QMainWindow):
def __init__(self, *args, **argvs):
super(userColaborador, self).__init__(*args, **argvs)
self.ui = Ui_userColaborador()
self.ui.setupUi(self)
self.ui.btn_exit.clicked.connect(self.exit)
app = load_app()
It is in this question that I do not know how to "save" the data built in function app = load_app()
when called upon by the class class login(QMainWindow)
so that the class class userColaborador(QMainWindow)
may catch you at some point when called.