Hello I have this red button:red button And I want it to change text to "+" after the first click I did it
from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtUiTools import QUiLoader
import sys
app = QApplication(sys.argv)
loader = QUiLoader()
window = loader.load("Strategion.ui", None)
class MainWindow(QWidget):
def __init__(self):
super().__init__()
window.pushButton.clicked.connect(self.btt1)
def btt1(self):
self.sender().setText("+")
if(self.sender().styleSheet() == 'background-color: rgb(0, 255, 0);font: 36pt "MS Shell" Dlg 2;'):
self.sender().setStyleSheet('background-color: rgb(255, 0, 0);font: 36pt "MS Shell" Dlg 2;')
else:
self.sender().setStyleSheet('background-color: rgb(0, 255, 0);font: 36pt "MS Shell" Dlg 2;')
if __name__ == "__main__":
start = MainWindow()
window.show()
app.exec()
and when i click the second time it should change the text, it shouldn't immediately change the text and color of the button at the same time, just the text first and then the color. Thank you in advance.