title: How to store the last checked item as default, when Opening next time , in PyQt5 QRadioButton?
body: <p>It's my code. How to store the lastly clicked/checked button as default in the next opening of the programme? For example: If we run the programme and click the 3rd button and close the entire programme. Whenever I reopen/re-run the programme, the lastly clicked button is checked by default ( ie. third button is checked by default)</p>
  <pre><code>import sys
  
  from PyQt5 import QtWidgets
  
  class RadioButton(QtWidgets.QWidget):
      def __init__(self):
          super(). __init__()
  
          self.setWindowTitle(&quot;Radio Button&quot;)
          self.rbtn1 = QtWidgets.QRadioButton(&quot;Button1&quot;)
          self.rbtn1.clicked.connect(self.getvalue)
  
          self.rbtn2 = QtWidgets.QRadioButton(&quot;Button2&quot;)
          self.rbtn2.clicked.connect(self.getvalue)
  
          self.rbtn3 = QtWidgets.QRadioButton(&quot;Button3&quot;)
          self.rbtn3.clicked.connect(self.getvalue)
  
          self.rbtn4 = QtWidgets.QRadioButton(&quot;Button4&quot;)
          self.rbtn4.clicked.connect(self.getvalue)
  
          vbox = QtWidgets.QVBoxLayout()
          vbox.addWidget(self.rbtn1)
          vbox.addWidget(self.rbtn2)
          vbox.addWidget(self.rbtn3)
          vbox.addWidget(self.rbtn4)
          self.setLayout(vbox)
  
      def getvalue(self):
          if self.rbtn1.isChecked():
              self.rbtn1.setChecked(True)
              print(&quot;Radio button 1 is checked&quot;)
          elif self.rbtn2.isChecked():
              self.rbtn2.setChecked(True)
              print(&quot;Radio button 2 is checked&quot;)
          elif self.rbtn3.isChecked():
              self.rbtn3.setChecked(True)
              print(&quot;Radio button 3 is checked&quot;)
          elif self.rbtn4.isChecked():
              self.rbtn4.setChecked(True)
              print(&quot;Radio button 4 is checked&quot;)
  
  if __name__ == &quot;__main__&quot;:
      app = QtWidgets.QApplication(sys.argv)
      win = RadioButton()
      win.show()
      sys.exit(app.exec_())
  </code></pre>