Qt notes (ten) Qt radio button slot function and implementation

Qt notes (ten) Qt radio button slot function and implementation

I feel that the writing is not good, but I am not very familiar with how to write the slot function of python QT. More elegant writing will be added later.
insert image description here

self.ui.radioLeftButton.toggled.connect(lambda : self.onChangeOperationSide(self.ui.radioLeftButton))
self.ui.radioRightButton.toggled.connect(lambda : self.onChangeOperationSide(self.ui.radioRightButton))


 def onChangeOperationSide(self, btn):
    if btn.isChecked() == True:
      # print(btn)
      if btn.name == "radioLeftButton":
        self._OperationSide = "Left"
        # print("operation side changed to left")
      if btn.name == "radioRightButton":
        self._OperationSide = "Right"
        # print("operation side changed to right")

Guess you like

Origin blog.csdn.net/juluwangriyue/article/details/123796728