0

I am making the GUI for a certain software. The individual parts of the GUI are finished, but I am having troubles liking them together. They are saved in different files as the backend and frontend for each are in the same file. What I want to do is, after the user chooses login, the login screen should open. On the login screen, if the user wants to go back, a back button is there to do so. Here is how that code looks like:

Login.py

class LoginScreenC(object):
def setupUi(self, MainWindow):
    MainWindow.setObjectName("MainWindow")
    MainWindow.resize(440, 285)
    self.BackButton = QtWidgets.QPushButton(self.centralwidget)
    self.BackButton.setGeometry(QtCore.QRect(240, 210, 75, 23))
    self.BackButton.setObjectName("BackButton")
    self.BackButton.clicked.connect(self.PrevPage)

 def PrevPage(self):
    self.close()

And here is ProfileSelect.py:

from Login import LoginScreenC 


  


 class ChooseProfilePage(object):
  def setupUi(self, MainWindow):
    MainWindow.setObjectName("MainWindow")
    MainWindow.resize(560, 408)
     self.LoginButton.clicked.connect(
        partial(self.pressedButton, "Login"))

def pressedButton(self, pressed):
    if pressed == "Login":
        self.loginwindow = LoginScreenC()
        self.loginwindow.show()

I have two problems here

1.) In Login.py, self.close() is showing the following error:

AttributeError: 'LoginScreenC' object has no attribute 'close'

2.) In ProfileSelect.py, PressedButton function is giving this error:

AttributeError: 'LoginScreenC' object has no attribute 'show'

I think both errors are pointing towards the same thing, but how exactly can I fix this? I used qt designer to build it.

Speedy
  • 50
  • 8
  • Pyuic generated files are not intended to be modified, as the warning on their top says. Follow the official guidelines about [using Designer](https://www.riverbankcomputing.com/static/Docs/PyQt5/designer.html) – musicamante Nov 06 '22 at 12:32

0 Answers0