Reputation: 1
SO , I am new in the Pyqt design. I use stacked widget for the setup and I do some operations in each widget. My problem is that, for example when I enter a number, say 50, in lineedit slot of Page2 it is fine I print what I enter. that is 50. Problem is when I leave the page and return, and If I enter 50 again, it prints 50, and 50. in my third revisiting page I print three 50s... and so on. below is my code. I couldnt understand why and I need to fix that. I appreciate if you can help me
class loadUi_example(QMainWindow):
def __init__(self):
super().__init__()
self.ui= Ui_MainWindow()
self.ui.setupUi(self)
self.TAHA_2_Training_Page_NumofFilter_object=TAHA_2_Training_Page_NumofFilter()
self.home_page_index =0
self.book_list_page_index =1
self.add_book_page_index =2
self.user_list_page_index =3
self.add_user_page_index =4
self.ui.actionHome_Page.triggered.connect(self.go_home_page)
self.ui.actionBooks.triggered.connect(self.go_training_page)
self.ui.actionAdd_Book.triggered.connect(self.go_addbook_page)
self.ui.actionUsers.triggered.connect(self.go_users_page)
self.ui.actionAdd_User.triggered.connect(self.go_add_user_page)
def go_addbook_page (self):
self.ui.stackedWidget.setCurrentWidget(self.ui.page_7)
pass
def go_training_page (self):
self.ui.stackedWidget.setCurrentWidget(self.ui.page_2)
self.ui.lineEdit_14.returnPressed.connect(self.training_page_line_edit_process)
self.ui.lineEdit_14.setPlaceholderText("Number of Epoch, hit Enter")
def training_page_line_edit_process(self):
epochs = self.ui.lineEdit_14.text()
print ("epochs: ", epochs)
Upvotes: 0
Views: 14