why predefined function do not work in pycharm
Unsolved
General and Desktop
-
i face this problem many times when i want to work with predefined functions in pycharms i do not know what is the problem or where . As example i want to work with those functions close() & hide() but there is an error that keeps showing up the error is :Error due to 'Ui_Login_Dialog' object has no attribute 'close'
this is an example of function i work withdef openwindow(self): try: self.nextui = QtWidgets.QWidget() self.ui = Registration.Ui_Registration() self.ui.setupUi(self.nextui) self.nextui.show() MainWindow.close() except Exception as e: print("Error!", f"Error due to {str(e)}")
-
Hi,
That's because these classes are no widgets, there are used to build the UI.
In you code snippet, you would use
self.nextui.hide()
to hide the widget that was created with the help ofRegistration.Ui_Registration
. That is the same for all the widgets you created that way.