title: How change radio button of Radio Button Group in cell of Table programatically?
body: <p>I want to change the selected radio button in group of radio button in cell table programatically.
  I try to recreate table after change the status in piece object but if I have many records it becomes slow.</p>
  <p>I have the next code:</p>
  <pre><code>import sys
  
  from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem, QHBoxLayout, QWidget, QButtonGroup, \
      QRadioButton, QVBoxLayout, QPushButton, QApplication
  
  
  class Piece:
      def __init__(self, init, name, status):
          self.init = init
          self.name = name
          self.status = status
  
  class Table(QWidget):
  
      def __init__(self, parent=None):
          super(Table, self).__init__(parent)
          self.debug_data()
          self.fila = 0
          self.init_ui()
  
      def debug_data(self):
          print(&quot;okay&quot;)
          self.pieces: [Piece] = []
          self.pieces.append(Piece('2021-01-11 13:52:00', 'Router 234', 1))
          self.pieces.append(Piece('2021-01-11 13:55:00', 'Router AB', 0))
          self.pieces.append(Piece('2021-01-11 14:00:00', 'Router A234E', 1))
          self.pieces.append(Piece('2021-01-11 14:01:00', 'Router Sufle', 0,))
  
      def _create_buttons(self):
          self.buttons_layout = QHBoxLayout()
          self.btn_ok_all = QPushButton(&quot;All Manual&quot;)
          self.btn_no_ok_all = QPushButton(&quot;All Automatic&quot;)
          self.btn_no_validate_all = QPushButton(&quot;All Hybrid&quot;)
          self.buttons_layout.addWidget(self.btn_ok_all)
          self.buttons_layout.addWidget(self.btn_no_ok_all)
          self.buttons_layout.addWidget(self.btn_no_validate_all)
          self.layout.addLayout(self.buttons_layout)
  
      def init_ui(self):
          self.createTable()
  
          self.layout = QVBoxLayout()
          self._create_buttons()
          self.layout.addWidget(self.tableWidget)
          self.setLayout(self.layout)
  
          self.show()
  
      def createTable(self):
          self.tableWidget = QTableWidget()
          self.tableWidget.setColumnCount(3)
          self.tableWidget.setHorizontalHeaderLabels(
              [&quot;Init Time&quot;, &quot;Name&quot;, &quot;Type&quot;])
          self.process_rows()
  
      def process_rows(self):
          for piece in self.pieces:
              self.add_row(piece)
  
      def add_row(self, piece):
          self.tableWidget.insertRow(self.fila)
          self.tableWidget.setItem(self.fila, 0, QTableWidgetItem(piece.init))
          self.tableWidget.setItem(self.fila, 1, QTableWidgetItem(piece.name))
          self.tableWidget.setCellWidget(self.fila, 2, self.create_group_radio_button(piece))
          self.fila = self.fila + 1
  
      def create_group_radio_button(self, piece):
          layout = QHBoxLayout()
          widget = QWidget(self)
          widget.setLayout(layout)
  
          number_group = QButtonGroup(widget)
          manual = QRadioButton(&quot;Manual&quot;)
          number_group.addButton(manual)
          automatic = QRadioButton(&quot;Automatic&quot;)
          number_group.addButton(automatic)
          hybrid = QRadioButton(&quot;Hybrid&quot;)
          number_group.addButton(hybrid)
          layout.addWidget(manual)
          layout.addWidget(automatic)
          layout.addWidget(hybrid)
          if piece.status == 0:
              hybrid.setChecked(True)
          elif piece.status == 1:
              manual.setChecked(True)
          else:
              automatic.setChecked(True)
          return widget
  
  
  if __name__ == '__main__':
      app = QApplication(sys.argv)
      ex = Table()
      sys.exit(app.exec_())
  </code></pre>
  <p>What is the way to change one of them programatically?
  How to access the cell widget and select the button to change it?</p>