I'm working with a PyQt5 GUI, and I find the problem. I want to share the object Person with the whole program, but when I do it, the program becomes recursion. I tried a lot of methods to share the object person to the other function, but always the object becomes or false or connection object. Does anybody know why it works like that?
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QDialog, QApplication, QListWidget, QListWidgetItem, QMainWindow, QVBoxLayout
from PyQt5.uic import loadUi
from lot import DatabaseofLoty
from person import Person
from ticket import Ticket
from classes_io import read_from_csv
from kamerdyner import Kamerydner, DatabaseofKamerdyner
from random import choice
kam1 = Kamerydner(1,"Jake")
kam2 = Kamerydner(2, "Christina")
kam3 = Kamerydner(3,"Robert")
databases = DatabaseofKamerdyner([kam1, kam2 ,kam3])
class Airport(QMainWindow):
def __init__(self):
super(Airport,self).__init__()
loadUi("airrport.ui",self)
def save():
global person
a = self.savefunction
person = a
def gotonewclas(a):
return self.gotonewclass(person)
self.Confirmbutton.clicked.connect(save)
self.Confirmbutton.clicked.connect(gotonewclas)
def savefunction(self):
name = self.name.text()
pesel = self.pesel.text()
birthdate = self.birthdate.text()
person = Person(name, pesel, birthdate)
return person
def gotonewclass(self,person):
print(person)
chooselot = Chooselot()
widget.addWidget(chooselot)
widget.setCurrentIndex(widget.currentIndex()+1)
def guiMain(args):
global widget
app = QApplication(args)
mainwindow = Airport()
widget=QtWidgets.QStackedWidget()
widget.addWidget(mainwindow)
widget.setFixedWidth(480)
widget.setFixedHeight(620)
widget.show()
return app.exec_()
if __name__ == "__main__":
guiMain(sys.argv)