I have a problem with button in pyside6, when I click the button, event not show anything (I print text on terminal), Note: objectName correct, there's no problem with that. this is my main.py code: import sys from PySide6.QtWidgets import QApplication from pages.main.main_window import MainWindow class App(): def __init__(self): self.app = QApplication(sys.argv) self.window = MainWindow() self.window.show() def run(self): sys.exit(self.app.exec()) def main(): app_instance = App() app_instance.run() if __name__ == "__main__": main() main_window.py : from PySide6.QtCore import Qt, QPoint from PySide6.QtWidgets import QMainWindow, QStackedWidget, QWidget, QVBoxLayout, QApplication # Import UI classes and widget classes as needed from pages.main.ui_main_window import Ui_MainWindow from widget.customer.customer_widget import CustomerWidget from widget.payment.payment import PaymentWidget from widget.water_consumption.water_consumption_widget import WaterConsumptionWidget from widget.daily_report.daily_report import DailyReportWidget from widget.monthly_report.monthly_report import MonthlyReportWidget class MainWindow(QMainWindow): def __init__(self): super().__init__() # Make the window frameless self.setWindowFlags(Qt.FramelessWindowHint) # Declare topbar variable to track maximize state self.isMaximized = False # Create and configure widgets self.customer_widget = QWidget() self.payment_widget = QWidget() self.water_consumption_widget = QWidget() self.daily_report_widget = QWidget() self.monthly_report_widget = QWidget() # Initialize UI for each widget self.customerUI() self.paymentUI() self.waterConsumptionUI() self.dailyReportUI() self.monthlyReportUI() # Create a stacked widget to hold the different pages self.stack = QStackedWidget(self) self.stack.addWidget(self.customer_widget) # Index 0 self.stack.addWidget(self.payment_widget) # Index 1 self.stack.addWidget(self.water_consumption_widget) # Index 2 self.stack.addWidget(self.daily_report_widget) # Index 3 self.stack.addWidget(self.monthly_report_widget) # Index 4 # Initialize main window UI self.ui = Ui_MainWindow() self.ui.setupUi(self) # Ensure visibility of necessary elements if not self.ui.bg.isVisible(): self.ui.bg.setVisible(True) if not self.ui.customerFrame.isVisible(): self.ui.customerFrame.setVisible(True) # Connect buttons to their respective methods self.connectButton() # Set layout for the customer frame to include the stacked widget self.ui.customerFrame.setLayout(QVBoxLayout()) self.ui.customerFrame.layout().addWidget(self.stack) def customerUI(self): CustomerWidget(self.customer_widget) def paymentUI(self): PaymentWidget().display(self.payment_widget) def waterConsumptionUI(self): WaterConsumptionWidget().display(self.water_consumption_widget) def dailyReportUI(self): DailyReportWidget().display(self.daily_report_widget) def monthlyReportUI(self): MonthlyReportWidget().display(self.monthly_report_widget) def connectButton(self): self.ui.customer.clicked.connect(self.showCustomer) self.ui.payment.clicked.connect(self.showPayment) self.ui.waterConsumption.clicked.connect(self.showWaterConsumption) self.ui.dailyReport.clicked.connect(self.showDailyReport) self.ui.monthlyReport.clicked.connect(self.showMonthlyReport) self.ui.close.clicked.connect(QApplication.instance().quit) self.ui.minimize.clicked.connect(self.showMinimized) self.ui.maximize.clicked.connect(self.toggleMaximize) def showCustomer(self): self.stack.setCurrentWidget(self.customer_widget) def showPayment(self): self.stack.setCurrentWidget(self.payment_widget) def showWaterConsumption(self): self.stack.setCurrentWidget(self.water_consumption_widget) def showDailyReport(self): self.stack.setCurrentWidget(self.daily_report_widget) def showMonthlyReport(self): self.stack.setCurrentWidget(self.monthly_report_widget) def toggleMaximize(self): if self.isMaximized: # If the window is currently maximized, restore it to its normal size self.showNormal() self.isMaximized = False else: # Otherwise, maximize the window self.showMaximized() self.isMaximized = True def mousePressEvent(self, event): self.oldPos = event.globalPos() def mouseMoveEvent(self, event): delta = QPoint(event.globalPos() - self.oldPos) self.move(self.x() + delta.x(), self.y() + delta.y()) self.oldPos = event.globalPos() def testButton(self): print("Test button clicked") self.customer_widget_ui.saveButton.setDisabled(True) customer_widget.py from PySide6.QtWidgets import QWidget, QApplication from widget.customer.ui_customer_widget import Ui_CustomerWidget class CustomerWidget(QWidget): def __init__(self, stack=None): super().__init__() self.customer_widget_ui = Ui_CustomerWidget() self.customer_widget_ui.setupUi(stack) self.customer_widget_ui.saveButton.clicked.connect(self.testButton) def inputCustomer(self): customerId = self.customer_widget_ui.customerIdInput.text() name = self.customer_widget_ui.nameInput.text() address = self.customer_widget_ui.addressInput.text() customerClass = self.customer_widget_ui.customerClassInput.text() village = self.customer_widget_ui.villageInput.text() initialMeter = self.customer_widget_ui.initialMetersInput.text() print(f"Customer ID: {customerId}") print(f"Name: {name}") print(f"Address: {address}") print(f"Customer Class: {customerClass}") print(f"Village: {village}") print(f"Initial Meter: {initialMeter}") def testButton(self): print("Test button clicked") # Add more debugging statements if needed print("Debugging inside testButton") Button can start excution of the event (in this case print, in terminal) Continue reading...